CC

Learn C – all lessons

18 lessons from beginner to advanced, building on each other and with code examples.

Beginner
1

Hello World, main & the Compiler

Your first C program, its parts and the path from source code to an executable file.

2

Variables, Data Types & Arithmetic

int, double, char, bool, sizeof, constants and the pitfalls of integer division.

3

Input and Output: printf, scanf, fgets

Formatted output and safe keyboard input.

4

Conditions: if, switch & Operators

Branching, comparisons, logical operators and the ternary operator.

5

Loops: for, while, do-while

Repetition, exit conditions, break/continue and nested loops.

6

Functions, Scope & Recursion

Defining and declaring functions, call by value, static variables and recursion.

7

Arrays

Fixed-size arrays: indexing, initialization, passing to functions and multidimensional arrays.

Intermediate
8

Pointers: Addresses & Dereferencing

What a pointer is, call by reference, pointer arithmetic and the relationship with arrays.

9

Strings as char Arrays

Null-terminated strings, string.h, safe copy and format functions.

10

structs, typedef, enum & union

Building your own data types: structures, enumerations, variants and access via pointers.

11

Dynamic Memory: malloc & free

Requesting, resizing and releasing memory at runtime – and avoiding typical mistakes.

12

Files & Error Handling

Reading and writing files with stdio, checking return codes, errno and cleaning up with goto.

13

Preprocessor, Headers & Multiple Files

#define, macros and their pitfalls, include guards, splitting into .h/.c and a Makefile.

Advanced
14

Function Pointers & Callbacks

Functions as values: callbacks, qsort and dispatch tables.

15

Data Structures: List & Stack

Linked list with pointer to pointer, array-based stack and ownership rules for memory.

16

Bit Operations & Fixed-Width Integer Types

Setting, clearing and testing bits; packing flags and color values; stdint.h.

17

Memory Layout, Padding & Qualifiers

Stack, heap and static memory; struct alignment; const, volatile and restrict.

18

Undefined Behavior, Security & Debugging

Recognizing and avoiding buffer overflows and other pitfalls, and tracking them down with sanitizers, Valgrind and gdb.