Skip to Main Content
C Programming: Visual Quickstart Guide
book

C Programming: Visual Quickstart Guide

by Larry Ullman, Marc Liyanage
October 2004
Beginner content levelBeginner
408 pages
9h 24m
English
Peachpit Press
Content preview from C Programming: Visual Quickstart Guide

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

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.
Start your free trial

You might also like

Intermediate C Programming

Intermediate C Programming

Yung-Hsiang Lu
Data Structures Using C

Data Structures Using C

Samir Kumar Bandyopadhyay, Kashi Nath Dey

Publisher Resources

ISBN: 0321287630Purchase book