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.

3.1 if and else conditions, else if chains, the conditional operator Open 3.2 switch cases, fallthrough, default, switch on enums Open 3.3 Loops for, while, do-while, nested loops, loop invariants Open 3.4 break, continue and goto early exits, continue, goto for cleanup Open 3.5 Recursion base cases, call stack, factorial, fibonacci, depth limits Open

Lessons