Learn C Programming

Lesson 2 of 8 · Undefined Behaviour, Debugging and Reading Real C

Module 16 · Undefined Behaviour, Debugging and Reading Real C

Debugging: printf, gdb, Sanitizers and a Method

ProReading

Kenji's bubble sort put a price nobody typed at the top of David's price list. Bob hunted all day, reading the loops line by line for an off-by-one, and found nothing.

Pro lesson

This one goes deeper

It is included with this track and with Learn Pro. Every question on the Skill Test can be answered from the free lessons, so this is depth and never a gate on the certificate.

What is inside Debugging: printf, gdb, Sanitizers and a Method

  1. Zara's method, one step at a time
  2. Halving Kenji's bubble sort
  3. Printing to find a bug, done right
  4. gdb: stop the program and look inside
  5. Sanitizers: two checkers in one build
  6. What the Playground tells you
  7. Explain it to a duck