Next: switch Statement, Previous: return Statement, Up: Statements [Contents][Index]
You can use a loop statement when you need to execute a series of statements repeatedly, making an iteration. C provides several different kinds of loop statements, described in the following subsections.
Every kind of loop statement is a complex statement because contains a component, here called body, which is a nested statement. Most often the body is a block.
|• while Statement||Loop as long as a test expression is true.|
|• do-while Statement||Execute a loop once, with further looping as long as a test expression is true.|
|• break Statement||End a loop immediately.|
|• for Statement||Iterative looping.|
|• Example of for||An example of iterative looping.|
|• Omitted for-Expressions||for-loop expression options.|
|• for-Index Declarations||for-loop declaration options.|
|• continue Statement||Begin the next cycle of a loop.|