Frontend Labs
⋯
🛠️

C — The Complete Field Guide (Beginner → Expert)

A practical, example-driven path through C: what the language actually gives you, why it's shaped the way it is, and how to read and write C that solves real problems — from a CLI tool to a TCP server to the internals of SQLite and Redis.

64 chapters · 2 h 14 min of reading

Contents

64 chapters, one page each. Prefer one long page? Read the whole book on one page.

  1. How to use this guide2 min
  2. Table of contents3 min
  3. Part I — Foundations: the C way
  4. 1. What C is, why it still matters, and which C you're learning3 min
  5. 2. The toolchain: the four-stage pipeline, and your first program3 min
  6. 3. Types and the sizes the standard actually guarantees2 min
  7. 4. Operators, control flow, and the details beginners skip1 min
  8. 5. Functions, the stack, and header files1 min
  9. 6. Arrays, pointers, and the arithmetic that explains everything else4 min
  10. 7. Strings in C: buffers, ownership, and why gets() was removed5 min
  11. 8. Structs, unions, enums, typedef , and the preprocessor5 min
  12. 9. Mini projects: a unit converter and a word-frequency counter3 min
  13. Part II — Intermediate: memory, modules, and tooling
  14. 10. Dynamic memory: the malloc family, ownership, and the bugs it enables3 min
  15. 11. Pointers to pointers, function pointers, pointers to arrays2 min
  16. 12. File I/O: buffering, binary vs. text mode, errno1 min
  17. 13. Multi-file programs: headers, static , translation units, and make1 min
  18. 14. Debugging and sanitizers: gdb/lldb, Valgrind, ASan/UBSan1 min
  19. 15. A minimal test harness for C1 min
  20. 16. Mini projects: a dynamic-array library + CSV parser, and a JSON parser6 min
  21. Part III — Advanced: data structures, concurrency, networking
  22. 17. Bit manipulation and bit-fields1 min
  23. 18. Data structures from scratch: linked lists, stacks/queues, hash tables, trees3 min
  24. 19. Intrusive containers: the Linux kernel's container_of trick2 min
  25. 20. Concurrency: POSIX threads, mutexes/condvars, C11 <threads.h> and atomics2 min
  26. 21. Sockets: a TCP echo server, then a tiny HTTP server2 min
  27. 22. Variadic functions and _Generic1 min
  28. 23. Mini projects: a thread pool, and a select() -based chat server3 min
  29. Part IV — Real-world builds
  30. 24. Building production CLIs: argument parsing, config precedence, exit codes1 min
  31. 25. Capstone: a kilo -style terminal text editor2 min
  32. 26. Capstone: a Unix mini-shell with pipes and redirection2 min
  33. 27. Capstone: a bump/arena allocator2 min
  34. Part V — Security-focused C
  35. 28. Undefined behavior: the list every C programmer must memorize2 min
  36. 29. Buffer overflows, safe string handling, and CERT C rules2 min
  37. 30. Hardening: compiler flags, canaries, ASLR, _FORTIFY_SOURCE1 min
  38. 31. Fuzzing a real parsing bug with libFuzzer1 min
  39. 32. Static analysis: clang-tidy, cppcheck, the Clang Static Analyzer1 min
  40. Part VI — Open-source package walkthroughs
  41. 33. SQLite: the amalgamation, the VFS layer, opcode-based execution2 min
  42. 34. Redis: the ae.c event loop, sds dynamic strings, object encoding2 min
  43. 35. curl: the easy/multi handle design and callback-driven I/O1 min
  44. 36. cJSON: recursive-descent parsing and tagged unions1 min
  45. 37. uthash and klib: generics via macros1 min
  46. Part VII — Expert: internals, allocators, API design
  47. 38. The C11 memory model: atomics, ordering, lock-free basics1 min
  48. 39. Writing a real allocator: free lists, coalescing, and dlmalloc 's ideas2 min
  49. 40. ABI, linking, and designing a stable C API1 min
  50. 41. Cross-compilation and build systems at scale (CMake/Meson)1 min
  51. 42. Profiling: perf , cache-aware layout, and false sharing2 min
  52. 43. Capstone: a mini Redis-like key-value store with a wire protocol2 min
  53. Part VIII — Writing safe, leak-free C
  54. 44. Memory leaks, in depth: every shape they actually take in production4 min
  55. 45. Writing safe C: a defensive-programming checklist2 min
  56. 46. How NOT to write C: a bad-code/good-code anti-pattern catalog5 min
  57. Part IX — Hardware & driver programming
  58. 47. Two worlds: user-space hardware I/O vs. writing a kernel driver1 min
  59. 48. Talking to hardware from user space: GPIO, I2C, SPI, and serial4 min
  60. 49. Memory-mapped registers: volatile , /dev/mem , and memory barriers4 min
  61. 50. Your first Linux kernel module: hello world, the Makefile, insmod/dmesg1 min
  62. 51. Character device drivers: file_operations , cdev , and copy_to/from_user2 min
  63. 52. Interrupts and kernel concurrency: top/bottom halves, spinlocks vs. mutexes2 min
  64. 53. Debugging drivers: printk /dmesg, an oops backtrace, and QEMU+gdb2 min
  65. 54. Capstone: one sensor, driven two ways2 min
  66. Part X — Signals, non-local jumps, and memory-mapped files
  67. 55. Signals: handling asynchronous events safely4 min
  68. 56. Non-local jumps: setjmp / longjmp and why they're not exceptions2 min
  69. 57. Memory-mapped files: mmap for real files, msync , and shared mappings3 min
  70. Appendices
  71. A. C17 → C23: what's new, feature by feature1 min
  72. B. Undefined-behavior and pitfalls cheat sheet1 min
  73. C. Compiler-flags cheat sheet1 min
  74. D. Glossary1 min
  75. E. Further reading and real codebases worth reading1 min

Generated from real-life-c-guide.md · 8 Oct 2026 16:36