C
C is the language underneath almost everything: operating systems, language runtimes, databases, embedded devices. Learning it means learning how a computer actually runs your code: how source becomes machine instructions, how numbers are laid out as bits, what a pointer is, where memory comes from and who gives it back. This track starts from zero (what a program is) and builds up through types, control flow, functions and the call stack, arrays, pointers, the heap, structs, files, multi-file builds, debugging with gdb and valgrind, data structures, bit manipulation and POSIX systems programming, ending with practical projects.
- Foundations: from source to running program
What a program is, how C source becomes an executable (preprocess, compile, assemble, link), main and exit status, printf, and reading compiler errors.- What a program is · 30 min · 4 exercises
- From source to executable · 40 min · 5 exercises
- Your first program: main and exit status · 35 min · 4 exercises
- printf, comments, and reading compiler messages · 45 min · 5 exercises
- Types and how data lives in memory
Bits, bytes, binary and hex; variables; integer types and their sizes; two's complement and overflow; characters; floating point and its limits.- Bits, bytes, binary and hexadecimal · 40 min · 5 exercises
- Variables, declarations and initialization · 40 min · 4 exercises
- Integer types, sizes and limits · 45 min · 5 exercises
- Two's complement, signed vs unsigned, and overflow · 50 min · 4 exercises
- Characters are small integers · 40 min · 4 exercises
- Floating point: how real numbers are approximated · 50 min · 4 exercises
- Operators, expressions and input
Arithmetic and integer division, precedence, implicit conversions and casts, comparison and logical operators, assignment and side effects, and reading input safely with scanf.- Arithmetic operators and integer division · 45 min · 5 exercises
- Conversions, promotions and casts · 50 min · 4 exercises
- Comparisons, logic and short-circuit evaluation · 45 min · 5 exercises
- Assignment, increment and side effects · 40 min · 4 exercises
- Reading input with scanf and checking it · 50 min · 4 exercises
- Control flow
Making decisions with if and switch, repeating with while, do-while and for, break and continue, and processing input until end of file.- Decisions: if, else and the conditional operator · 45 min · 4 exercises
- switch and multi-way choices · 40 min · 4 exercises
- Loops: while, do-while and for · 50 min · 5 exercises
- break, continue, nested loops and loop patterns · 55 min · 4 exercises
- Processing input until end of file · 55 min · 4 exercises
- Functions and the call stack
Defining and declaring functions, pass-by-value, what happens on the call stack, recursion, scope, lifetime, and static.- Defining and calling functions · 45 min · 4 exercises
- Prototypes, declarations and pass-by-value · 45 min · 4 exercises
- The call stack and stack frames · 50 min · 4 exercises
- Recursion · 55 min · 5 exercises
- Scope, lifetime, globals and static · 50 min · 4 exercises
- Arrays and strings
Arrays in memory, bounds and why C does not check them, passing arrays to functions, multidimensional arrays, strings and the null terminator, string.h, buffer overflows, and command-line arguments.- Arrays: contiguous memory · 45 min · 4 exercises
- Arrays and functions · 45 min · 4 exercises
- Multidimensional arrays · 45 min · 4 exercises
- Strings and the null terminator · 45 min · 4 exercises
- The string library and buffer overflows · 55 min · 4 exercises
- Command-line arguments · 50 min · 4 exercises
- Pointers
The core of C: addresses, the & and * operators, memory diagrams, pointers as function parameters, pointer arithmetic and array decay, pointers to pointers, const, void pointers and function pointers.- Addresses and pointers · 55 min · 5 exercises
- Pointers as function parameters · 50 min · 4 exercises
- Pointer arithmetic and arrays · 55 min · 5 exercises
- Strings through pointers · 50 min · 4 exercises
- Pointers to pointers and const · 55 min · 4 exercises
- void pointers and function pointers · 60 min · 4 exercises
- Dynamic memory
Stack versus heap, malloc and free, calloc and realloc, growing buffers, memory errors (leaks, use-after-free, double free) and finding them with valgrind, and ownership.- Stack and heap · 40 min · 4 exercises
- malloc and free · 45 min · 3 exercises
- calloc, realloc and growing buffers · 55 min · 4 exercises
- Memory bugs and valgrind · 50 min · 4 exercises
- Ownership and cleanup patterns · 55 min · 3 exercises
- Structs, unions, enums and typedef
Grouping data with structs, layout and padding, pointers to structs, arrays of structs, enums, typedef, unions and tagged unions.- Structs · 45 min · 4 exercises
- Struct layout, padding and sizeof · 40 min · 4 exercises
- Pointers to structs and arrays of structs · 55 min · 4 exercises
- Enums and typedef · 45 min · 4 exercises
- Unions and tagged unions · 50 min · 4 exercises
- Input, output and files
Streams and buffering, stdin, stdout and stderr, opening and reading files, error checking with errno and perror, robust parsing with strtol, and binary I/O.- Streams, buffering and stderr · 45 min · 4 exercises
- Opening, reading and writing files · 50 min · 4 exercises
- Errors: return values, errno and perror · 45 min · 4 exercises
- Robust parsing with fgets and strtol · 55 min · 4 exercises
- Binary files: fread, fwrite and fseek · 50 min · 4 exercises
- The preprocessor, multi-file programs and make
#include and #define, macro pitfalls, conditional compilation, splitting a program into translation units, headers and include guards, linkage (extern and static), and building with make.- The preprocessor: include, define and macros · 50 min · 4 exercises
- Conditional compilation · 40 min · 4 exercises
- Multi-file programs and headers · 55 min · 4 exercises
- Linkage: extern and static · 50 min · 4 exercises
- Building with make · 55 min · 4 exercises
- Debugging and undefined behavior
Using gdb to step through code and inspect memory, valgrind and the sanitizers, what undefined behavior is and the common cases, and writing defensive C with warnings and assert.- Debugging with gdb · 50 min · 5 exercises
- valgrind and the sanitizers · 50 min · 4 exercises
- Undefined behavior · 55 min · 4 exercises
- Defensive C: warnings, assert and habits · 45 min · 4 exercises
- Bit manipulation
Bitwise operators and shifts, masks and flags, common bit tricks, and endianness and byte-level serialization.- Bitwise operators and shifts · 45 min · 4 exercises
- Masks, flags and bit fields · 50 min · 4 exercises
- Bit tricks · 45 min · 4 exercises
- Endianness and serialization · 45 min · 4 exercises
- Data structures in C
Building the classic structures by hand: a growable dynamic array, a linked list, stacks and queues, a hash table, and a binary search tree.- A dynamic array · 55 min · 4 exercises
- Linked lists · 60 min · 5 exercises
- Stacks and queues · 55 min · 4 exercises
- Hash tables · 65 min · 4 exercises
- Binary search trees · 65 min · 4 exercises
- Systems programming with POSIX
A taste of programming the operating system: file descriptors and open/read/write, processes with fork, exec and wait, pipes, signals, and the environment.- File descriptors: open, read, write, close · 60 min · 4 exercises
- Processes: fork, exec and wait · 65 min · 4 exercises
- Pipes and redirection · 65 min · 4 exercises
- Signals and the environment · 60 min · 4 exercises
- Projects
Putting it all together in small but real programs: a word-frequency counter, a reverse-Polish calculator, a mini grep, and a tiny shell.- Project: word frequency counter · 90 min · 4 exercises
- Project: RPN calculator · 90 min · 4 exercises
- Project: mini grep · 100 min · 4 exercises
- Project: a tiny shell · 120 min · 5 exercises