Control flow

This part of the C course is the flow of a program: if and else, switch, the three loops, the early exits of break, continue and goto, and recursion. Each lesson shows the shape, the bug that hides in it — a missing break, an off-by-one bound, a recursion without a base case — and the diagnostic the compiler prints.

12 if and else conditions, else if chains, the conditional operator Open 13 switch cases, fallthrough, default, switch on enums Open 14 Loops for, while, do-while, nested loops, loop invariants Open 15 break, continue and goto early exits, continue, goto for cleanup Open 16 Recursion base cases, call stack, factorial, fibonacci, depth limits Open

Lessons