C & Memory
Compilation, pointers, stack vs. heap, malloc/free, structs, POSIX sockets, and memory bugs.
Chapter 1: How C Compiles (Preprocess, Compile, Assemble, Link)
Tracing a single `.c` file all the way to native machine instructions: preprocessor expansion, assembly generation, object files, static vs. dynamic linking, and inspecting symbols.
Chapter 2: Primitive Types, Signed/Unsigned Traps & Bitwise Mastery
Exact-width integers (`stdint.h`), two's complement binary, integer promotion bugs, endianness, and bitwise flags, masks, and shifts.
Chapter 3: Pointers Demystified (Addresses, `const` & Arithmetic)
Mastering C's superpower once and for all: `&` address-of, `*` dereference, pass-by-pointer mutation, scaled pointer arithmetic, `NULL`, and reading complex `const` declarations right-to-left.
Chapter 4: Arrays, Strings & Defeating Buffer Overflows
Array-to-pointer decay, NUL-terminated C strings, why `gets`/`strcpy`/`sprintf` cause CVEs, and safe bounded string handling with `snprintf`, `memcpy`, and explicit `(ptr, len)` slices.
Chapter 5: The Stack — Call Frames, Locals & Recursion Limits
Understanding automatic storage: how the CPU stack pointer (`SP`) allocates locals in ONE instruction, stack frames, stack overflow limits, and avoiding VLAs.
Chapter 6: The Heap — `malloc`, `calloc`, `realloc`, `free` & Arenas
Mastering manual dynamic memory without leaks or corruption: ownership discipline, `calloc` overflow protection, the `realloc` leak trap, allocator internals, and arena allocators.
Chapter 7: `struct`, `union`, Padding, Alignment & Bitfields
Mastering how C lays out data structures in RAM: alignment padding, field ordering for smaller/faster structs, tagged unions, flexible array members, and binary serialization.
Chapter 8: Function Pointers, Callbacks, `void *` & Vtables
Treating behavior as data in C: function pointer syntax with `typedef`, `qsort` comparators, passing context via `void *ctx`, and building clean vtable polymorphism like the Linux kernel.
Chapter 9: File I/O, Buffering & POSIX Syscalls (`open`, `read`, `mmap`)
Going straight to the kernel: `<stdio.h>` buffered `FILE *` vs. raw POSIX file descriptors, partial reads/writes & `EINTR`, atomic file replacement, and zero-copy `mmap()`.
Chapter 10: Preprocessor Macros, Header Guards & `make`
Taming C's text preprocessor without shooting your foot off: header guards, macro parentheses & double-evaluation traps, `do { ... } while (0)`, conditional compilation, and clean `Makefile` builds.
Chapter 11: Undefined Behavior (UB) — Why Optimizers Seem 'Evil'
Understanding C's contract with optimizing compilers: signed overflow, uninitialized reads, strict aliasing (`memcpy` type punning!), sequence points, and writing UB-free code.
Chapter 12: Memory Bugs & Sanitizers (ASan, UBSan, Leaks & Debuggers)
Turning invisible C memory bugs into crystal-clear stack traces in seconds: AddressSanitizer (ASan), LeakSanitizer, UndefinedBehaviorSanitizer, `lldb`/`gdb`, and fuzzing with `libFuzzer`.
Chapter 13: Concurrency in C — `pthreads`, Mutexes, Atomics & Races
Multi-core programming without corruption: `pthread_create`/`join`, data races, `pthread_mutex_t`, condition variables (spurious wakeups!), deadlocks, C11 `<stdatomic.h>`, and ThreadSanitizer (TSan).
Chapter 14: POSIX Sockets & Secure Systems C
Putting everything together on the wire: TCP client/server lifecycle (`getaddrinfo`, `socket`, `bind`, `listen`, `accept`), `SO_REUSEADDR`, non-blocking `poll()`, defensive binary parsing, and production C hardening.