The For Loop
The final control structure we discuss in this chapter (and in the book) is the for loop. Much like while, it will perform an operation for a certain number of iterations. The syntax, though, is vastly different:
for (initial expression; conditional; concluding expression) { /* Do whatever. */ }
The first time the application encounters the loop, the initial expression will be executed. Then the conditional will be checked. If true, the statements (marked by Do whatever. earlier) are run. Then, the concluding expression is executed. Finally, the condition is checked again and the process is repeated (except that the initial expression is only run the first time; see Figure 4.16). With the for loop, the concluding expression is ...
Get C Programming: Visual Quickstart Guide 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.