Chapter Summary
The main topic of this chapter has been program control. C offers you many aids for structuring your programs. The while and the for statements provide entry-condition loops. The for statements are particularly suited for loops that involve initialization and updating. The comma operator enables you to initialize and update more than one variable in a for loop. For the rare occasion when an exit-condition loop is needed, C has the do while statement.
All these loops use a test condition to determine whether another loop cycle is to be executed. In general, the loop continues if the test expression evaluates to a nonzero value, and terminates otherwise. Often, the test condition is a relational expression, which is an expression ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access