K&R C Chapter 3 Exercise Solutions — Control Flow

Chapter 3: Control Flow covers C’s branching and looping constructs. It is short (6 exercises) but the exercises are non-trivial: exercise 3-3 implements expand(s1,s2) to expand shorthand like a-z into the full alphabet; 3-4 handles itoa for the most negative integer (a classic overflow trap); 3-5 converts integers to arbitrary bases. These are worked solutions …