Skip to main content

Book Exercise Lanes

This module's exercise system is book-driven. Use these local chunks for targeted volume after you have already learned the concept from the guide.

How To Use This Page​

  1. Finish the relevant concept page first.
  2. Write and compile at least one small program of your own from memory.
  3. Only then open the matching exercise lane.
  4. Keep a mistake log with tags such as missing prototype, format-string mismatch, buffer overrun, signed overflow, array decay, double free, macro without parentheses.

Lane 1: Compilation, Translation, and the C Mental Model​

Use this lane when you understand the four stages but cannot reliably localize compiler vs linker errors, or when undefined-behavior reading is still guesswork.

Target outcomes:

  • a hand-drawn translation-pipeline diagram labeled with actual files from your own program
  • at least 10 UB-reading classifications done without looking up the rule first
  • a log of three distinct compiler errors and three distinct linker errors you produced on purpose and then fixed

Lane 2: Types, Expressions, and Control Flow​

Use this lane when you can read K&R chapters 2 and 3 but still fall into precedence, promotion, or sequence-point traps.

Target outcomes:

  • 10 precedence drills solved without parentheses first, then rewritten with full parentheses
  • 6 sequence-point snippets each either proven defined or rewritten as two statements
  • 4 loop patterns (for counted, while with complex condition, do/while, nested loops with break)
  • 4 conversion drills with <limits.h> values printed and explained

Lane 3: Functions, Scope, and the Preprocessor​

Use this lane once you can write single-file programs but your multi-file projects still misbehave.

Target outcomes:

  • a three-file program where nm output shows the expected mix of T, t, and U symbols
  • 6 macro drills, at least 2 that you deliberately break and then fix with parentheses or by switching to static inline
  • a written one-page summary of scope vs linkage vs storage duration with your own examples
  • a header_guard experiment: intentionally misplace #endif and then fix it

Lane 4: Arrays, Pointers, Strings, Structs, and I/O​

Use this lane when most of the language is comfortable but your C strings and struct designs still produce memory bugs.

Target outcomes:

  • 5 C-string helpers reimplemented from memory with passing tests
  • 2 structs with explicit written invariants and accessor functions
  • 1 tagged union with a print routine
  • 1 fgets-based line-reader program that handles EOF, ferror, and trailing newline correctly
  • 1 multi-file project with main.c, at least one module .c/.h, and a working Makefile

Self-Curated Problem Set​

Build a custom set with these minimums:

  • 5 translation-pipeline or UB-reading exercises
  • 5 type / precedence / sequence-point exercises
  • 5 function, scope, or linkage exercises
  • 5 array / pointer / C-string exercises
  • 3 struct / union / typedef exercises
  • 3 multi-file / Makefile exercises

Completion Checklist​

  • Completed at least one lane end-to-end
  • Retained actual mistakes, their evidence and corrections; if none occurred, label a deliberately faulty example and show how to detect it. No minimum personal-error count.
  • Wrote at least 10 small programs that compile clean under -Wall -Wextra -std=c11
  • Built at least one multi-file project with a working Makefile
  • Used gcc -E, gcc -S, gcc -c, and nm on your own output at least once
  • Re-read the K&R chunk behind at least 3 bugs after fixing them

Required input-contract extension​

Complete the C input readiness bridge and CI1–CI6. The 18–26-hour package replaces the former two-hour line-reader exercise. It does not establish a full module workload; original practice remains required.