Chapter 3. Everything is about control
This chapter covers
- Conditional execution with if
- Iterating over domains
- Making multiple selections
In our introductory example, listing 1.1, we saw two different constructs that allowed us to control the flow of a program’s execution: functions and the for iteration. Functions are a way to transfer control unconditionally. The call transfers control unconditionally to the function, and a return statement unconditionally transfers it back to the caller. We will come back to functions in chapter 7.
The for statement is different in that it has a controlling condition (i < 5 in the example) that regulates if and when the dependent block or statement ({ printf(...) }) is executed. C has five conditional ...
Get Modern C now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.