C Programming Course
C Programming Tutorial — basics, functions, pointers, memory management, file handling, and systems programming.
Enterprise learning path
Start Here
1 · Basics
- 3Setting Up C Development Environment
A productive C setup needs three pieces: a compiler toolchain (GCC or Clang), an editor you are comfortable in, and a shell for build commands.
- 4Run C Program in Terminal
The usual workflow is edit source in a file, invoke the compiler from a shell, then launch the binary it produces.
- 5Compilation Process
The C compilation process transforms source code into an executable through preprocessing, compilation, assembly, and linking.
- 6Identifiers
Identifiers are names for variables, functions, and types.
- 7Keywords
Keywords are reserved words with special meaning — int, return, if, while, struct, etc.
- 8Input and Output
Console I/O lives in stdio.h: formatted output with printf and formatted input with scanf.
- 9Variables
Variables are named regions of memory with a fixed type.
- 10Data Types
Types tell the compiler how to interpret bits — integers, characters, and floating-point forms each have rules for size, range, and printf/scanf specifiers.
- 11Quiz: Basics | Variables | Data Types
Quiz: Basics | Variables | Data Types checks how well you can apply Valid vs invalid identifiers and Size of int and char on your system (and related ideas) in C.
- 12Operators
Operators combine values — arithmetic for math, relational and logical for decisions, bitwise for flags, and compound assignment for updates in place.
- 13Quiz: Input and Output | Operators
Quiz: Input and Output | Operators checks how well you can apply printf with multiple specifiers and scanf with & for integers (and related ideas) in C.
- 14Conditional Statements
Branching chooses which block runs — chained if/else for ranges, switch when matching one integral value against many labels.
- 15Loops
Loops rerun a block — for when you know the trip count, while when you only know the stop condition, do-while when the body must run at least once.
- 16Quiz: Conditional Statements and Loops
Quiz: Conditional Statements and Loops checks how well you can apply if-else ladder for grade ranges and switch without break behavior (and related ideas) in C.
2 · Functions
- 17Functions
Functions package logic behind a name and parameter list so you can reuse behavior and keep main() readable.
- 18Parameter Passing Techniques
Arguments are copied by default.
- 19Main Function
The main function is the entry point of every C program.
- 20Recursion
Recursion is when a function calls itself.
- 21Inline Function
Inline Function builds on this idea: inline as a hint to embed bodies at call sites.
- 22Nested Functions
Nested Functions builds on this idea: GCC nested definitions — non-standard but occasionally seen.
- 23Quiz: Functions
Quiz: Functions checks how well you can apply Function prototype purpose and Return type void (and related ideas) in C.
3 · Arrays and Strings
- 24Arrays in C
An array holds multiple values of one type in a single, contiguous block of memory.
- 25Multidimensional Arrays
A multidimensional array stores data in two or more dimensions — commonly 2D arrays for matrices and grids.
- 26Strings
Text in C is a char array terminated by a zero byte.
- 27String Functions
String functions from string.h — strlen, strcpy, strcat, strcmp, and safer variants strncpy, strncat.
- 28Quiz: Arrays | Strings
Quiz: Arrays | Strings checks how well you can apply Index of first and last element and Null terminator in strings (and related ideas) in C.
4 · Pointers
- 29Pointers
A pointer variable records an address.
- 30Pointer Arithmetic
Pointer arithmetic moves pointers by sizeof(type) — p+1 points to the next element in an array.
- 31Pointer to Pointer
Pointer to Pointer builds on this idea: Double indirection for dynamic 2D data and argv.
- 32Function Pointers
Function Pointers builds on this idea: Store call targets for callbacks and dispatch tables.
- 33Quiz: Pointers
Quiz: Pointers checks how well you can apply Difference between & and * and Pointer arithmetic on int* (and related ideas) in C.
5 · User Defined Data Types
- 34Structures
A structure (struct) groups related variables of different types under one name — ideal for records like Student or Point.
- 35Unions
A union shares one memory block among members — size equals largest member; only one member active at a time.
- 36Enumeration (enum)
enum defines named integer constants — improves readability over raw numbers.
- 37Quiz: Structure & Union
Quiz: Structure & Union checks how well you can apply Memory layout of struct and Union size equals largest member (and related ideas) in C.
6 · Memory Management
- 38Program's Memory Layout
A C program's memory layout includes text (code), data (globals), BSS (uninitialized globals), heap (dynamic), and stack (locals, calls).
- 39Dynamic Memory Allocation
Dynamic memory allocation reserves memory at runtime on the heap using malloc, calloc, realloc, and releases it with free.
- 40Memory Leaks
A memory leak occurs when heap memory is allocated but never freed — program loses access while memory stays reserved.
- 41Quiz: Memory Management
Quiz: Memory Management checks how well you can apply Stack vs heap and When to use calloc vs malloc (and related ideas) in C.
7 · File Handling
- 42Basics of File Handling
File handling in C uses FILE pointers — fopen to open, fclose to close, and fprintf/fscanf or fread/fwrite for data.
- 43Read a File
Read a File builds on this idea: Line and block reads from disk.
- 44Read/Write Structure From/to a File
Read/Write Structure From/to a File builds on this idea: Binary persistence with fread/fwrite.
- 45EOF, getc() and feof()
EOF, getc() and feof() builds on this idea: Detecting end-of-file while reading char by char.
- 46Delete a File
Delete a File builds on this idea: remove() and filesystem cleanup.
- 47Quiz: File Handling
Quiz: File Handling checks how well you can apply fopen modes r and w and feof vs ferror (and related ideas) in C.
8 · Error Handling
- 48Error Handling
Error Handling builds on this idea: Return codes, errno, perror, strerror.
- 49Exception Handling Using goto
Exception Handling Using goto builds on this idea: Centralized cleanup without C++ exceptions.
- 50File Error Handling
File Error Handling builds on this idea: Guard every fopen and check ferror/feof.
- 51Divide by Zero Exception
Divide by Zero Exception builds on this idea: Validate divisors — C does not catch this for you.
9 · Miscellaneous Concepts
- 52Preprocessors
The preprocessor runs before compilation — handles #include, #define, #ifdef, and conditional compilation.
- 53Macros
Macros are preprocessor text replacements — object-like (#define MAX 100) and function-like (#define SQR(x) ((x)*(x))).
- 54Quiz: Preprocessors and Macros
Quiz: Preprocessors and Macros checks how well you can apply Macro vs const variable and Include guard pattern (and related ideas) in C.
- 55Header Files
Header Files builds on this idea: Split interfaces (.h) from implementations (.c).
- 56Date and Time
Date and Time builds on this idea: time.h utilities for clocks and formatting.
- 57Linkage
Linkage builds on this idea: Which translation units may see a symbol.
- 58Storage Classes
Storage classes — auto (local default), register (hint), static (persistent/block scope), extern (global linkage).
- 59Quiz: Storage Classes
Quiz: Storage Classes checks how well you can apply static local retention and extern linkage (and related ideas) in C.
10 · Advanced Concepts
- 60Variadic Functions
Variadic Functions builds on this idea: Variable argument lists via stdarg.h.
- 61Input-Output System Calls
Input-Output System Calls builds on this idea: Unix read/write on file descriptors.
- 62Signals
Signals builds on this idea: Asynchronous notifications such as SIGINT.
- 63Socket Programming
Socket Programming builds on this idea: Network endpoints with the BSD socket API.
- 64_Generics Keyword
_Generics Keyword builds on this idea: C11 _Generic for type-selected macros.
- 65Multithreading
Multithreading in C often uses POSIX pthreads — create threads, share address space, synchronize with mutexes.