A comprehensive collection of C programming exercises, examples, and learning resources. This repository serves as my personal journey to master the C programming language through hands-on practice and systematic learning.
- About
- Repository Structure
- Prerequisites
- Getting Started
- Learning Path
- Topics Covered
- How to Use This Repository
- Compilation and Execution
- Contributing
- Resources
- License
This repository documents my journey learning C programming. Starting from basic syntax to advanced concepts, each topic is reinforced with practical exercises and real-world examples. The goal is to build a strong foundation in C programming through consistent practice and problem-solving.
c-learning/
│
├── README.md # This file
├── LICENSE # MIT License
│
├── basics/ # Fundamental concepts
│ ├── hello_world.c
│ ├── variables.c
│ ├── data_types.c
│ ├── operators.c
│ └── input_output.c
│
├── control_flow/ # Control structures
│ ├── if_else.c
│ ├── switch_case.c
│ ├── loops/
│ │ ├── for_loop.c
│ │ ├── while_loop.c
│ │ └── do_while.c
│ └── break_continue.c
│
├── functions/ # Function concepts
│ ├── basic_functions.c
│ ├── recursion.c
│ ├── scope_lifetime.c
│ └── function_pointers.c
│
├── arrays_pointers/ # Arrays and pointers
│ ├── arrays/
│ │ ├── 1d_arrays.c
│ │ ├── 2d_arrays.c
│ │ └── array_operations.c
│ └── pointers/
│ ├── pointer_basics.c
│ ├── pointer_arithmetic.c
│ └── pointers_arrays.c
│
├── strings/ # String manipulation
│ ├── string_functions.c
│ ├── string_operations.c
│ └── string_arrays.c
│
├── structures_unions/ # User-defined types
│ ├── structures.c
│ ├── nested_structures.c
│ ├── unions.c
│ └── typedef.c
│
├── dynamic_memory/ # Memory management
│ ├── malloc_calloc.c
│ ├── realloc_free.c
│ └── memory_leaks.c
│
├── file_io/ # File operations
│ ├── file_read_write.c
│ ├── file_append.c
│ └── binary_files.c
│
└── exercises/ # Practice problems
├── easy/
├── medium/
└── hard/
To compile and run C programs, you'll need:
-
Linux/Mac: GCC compiler
sudo apt-get install gcc # Ubuntu/Debian brew install gcc # macOS
-
Windows:
- MinGW-w64
- Or use WSL (Windows Subsystem for Linux)
- Or use an IDE like Code::Blocks, Dev-C++
-
Clone the repository
git clone https://github.com/DavFilsDev/c-programming-syntax-training.git
-
Navigate to any directory and compile a program
cd c-programming-syntax-training/basics gcc hello_world.c -o hello_world ./hello_world -
Start learning! Follow the topics in order or jump to areas you want to practice.
- Basic syntax and structure
- Variables and data types
- Operators and expressions
- Input/Output operations
- Conditional statements (if, else, switch)
- Loops (for, while, do-while)
- Break and continue
- Function declaration and definition
- Parameter passing (by value vs by reference)
- Recursion
- Scope and lifetime
- One and multi-dimensional arrays
- Pointer fundamentals
- Pointer arithmetic
- Relationship between arrays and pointers
- Strings and string functions
- Structures and unions
- Dynamic memory allocation
- File handling
- Read the code: Each file contains commented explanations
- Compile and run: See the output and experiment
- Modify: Change values and observe results
- Practice: Solve the exercises in the
exercises/directory
# Navigate to exercises
cd exercises/easy
# Solve a problem
# Create your solution file
nano problem1.c
# Compile and test
gcc problem1.c -o problem1
./problem1gcc program.c -o program
./programgcc -Wall -Wextra -Werror program.c -o program
./programgcc -g program.c -o program
gdb ./programgcc file1.c file2.c -o program
./program- "The C Programming Language" - Kernighan & Ritchie (K&R)
- "C Programming: A Modern Approach" - K.N. King
- "Head First C" - David Griffiths
- GeeksforGeeks C Programming
- C Programming Tutorial (TutorialsPoint)
- Learn-C.org
- C Reference (cppreference.com)
- Complete 100+ C programming exercises
- Master memory management concepts
- Understand system-level programming
- Prepare for technical interviews
This project is licensed under the MIT License - see the LICENSE file for details.
Happy Coding! 🚀
"The only way to learn a new programming language is by writing programs in it." - Dennis Ritchie