O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required