Debugging C on purpose
A real debugging method for C: shrink the failing input, trace the state with printf, guard assumptions with assert and read runtime errors for clues.
- The skill
- Track down a C bug with a method: shrink the input, trace the state, assert assumptions and halve the search.
- You make
- Fixes for a streak counter, a word counter and an average, and a search that finds the first broken version of a game.
Premium lesson
£7.99 a month or £59 a year. Cancel any time.
Builds on 24 Checkpoint: memory you manage. Free to try: C Foundations and the playground.
Passed
You can now
Keep going
Step 1 of 9
exercise_1.c
You've reached the good stuff.
5 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.
C, 32-bit: int and pointers are 4 bytes