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
- Finish the relevant concept page first.
- Write and compile at least one small program of your own from memory.
- Only then open the matching exercise lane.
- 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.
- K&R: Getting started
- K&R: Variables and arithmetic expressions
- COD: Translating and starting a program
- COD: Translating and starting a program (Part 2)
- COD: Translating and starting a program (Part 3)
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.
- K&R: Type conversions
- K&R: Increment and decrement operators
- K&R: Bitwise operators
- K&R: Precedence and order of evaluation
- K&R: Loops - while and for
- K&R: Break and continue
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 (
forcounted,whilewith complex condition,do/while, nested loops withbreak) - 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.
- K&R: Basics of functions
- K&R: External variables
- K&R: Scope rules
- K&R: Initialization
- K&R: The C preprocessor
- K&R: Scope and linkage (A.11)
Target outcomes:
- a three-file program where
nmoutput shows the expected mix ofT,t, andUsymbols - 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_guardexperiment: intentionally misplace#endifand 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.
- K&R: Character arrays
- K&R: Pointers and addresses
- K&R: Pointers and function arguments
- K&R: Pointers and arrays
- K&R: Address arithmetic
- K&R: Character pointers and functions
- K&R: Basics of structures
- K&R: Structures and functions
- K&R: typedef
- K&R: Unions
- K&R: Standard input and output
- K&R: Formatted input scanf
- K&R: File access
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 workingMakefile
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 /
Makefileexercises
Completion Checklist
- Completed at least one lane end-to-end
- Logged at least 12 real mistakes and corrections with source tags
- 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, andnmon your own output at least once - Re-read the K&R chunk behind at least 3 bugs after fixing them