Chapter 3 Flow Control

Flow control—diverting execution by looping and branching—is one area where C closely resembles other languages. If you know how to loop and branch in QuickBasic or QuickPascal, learning the C equivalents is mainly a matter of adjusting to somewhat different syntax. Here, as elsewhere, C never uses two keywords when one will do. For instance, C has no “then” keyword. Instead, it uses simple punctuation.

This chapter has two parts. The first part examines the looping statements: while, do, and for. The second part describes the decision-making statements: if, else, switch, break, continue, and goto.