Learn modern C (C23 with GCC 15) from your first printf to pointers, memory and a small inventory program, with every exercise checked as you go.
15 lessons, 29 exercises. Runs C GCC 15.
Not started
Hello, output
Write your first C program, print text with printf and puts, add comments, and see how a C program is built and run.
Values and variables
Store numbers, characters and true/false values in typed variables, name them well, and lock fixed values with const and constexpr.
Reading input and arithmetic
Read numbers from standard input with scanf, do arithmetic with C's operators, and avoid the traps of integer division.
Making decisions
Choose between paths with if, else and switch, and combine conditions with comparison and logical operators.
Loops
Repeat work with for, while and do-while loops, and leave a loop early with break and continue.
Functions
Split a program into named functions with parameters and return values, and understand how C copies arguments and limits scope.
Arrays
Store many values of the same type in an array, loop over it safely, and use an array of counters as a simple lookup table.
Strings and a small project
Work with C strings as null-terminated char arrays, read whole lines with fgets, use the string.h and ctype.h helpers, and build a word statistics tool.
Handling errors
Detect and report failures the C way, with return values, status codes, errno and careful input parsing using strtol.
Structuring data with structs
Group related values into structs, initialize them by name, pass them to functions, and keep arrays of records.
Recursion
Solve problems by having a function call itself on a smaller piece, with a base case that stops it, and see how the call stack makes this work.
Sorting and searching
Sort any array with qsort and a comparison function, order records by several keys, and find items fast with binary search and bsearch.
Maps and sets in C
Build the key-value tables and sets that C leaves out, from simple lookup arrays to a small hash table, and do set operations with boolean arrays and bit masks.
Pointers and memory
Understand C's signature feature, pointers, from addresses and dereferencing to pointer arithmetic, and manage your own memory with malloc, realloc and free.
Final project: shop inventory
Combine structs, strings, pointers, error handling and sorting into a command-driven inventory program.
Your progress is saved in this browser. Sign in to keep it on every device.