|
|
HP-UX/HP C Compiler: HP C/HP-UX Reference Manual > Chapter 6 Statements do...while |
|
The do statement executes statements within a loop until a specified condition is satisfied. This is one of the three looping constructions in C. Unlike the for and while loops, dowhile performs statement first and then tests expression. If expression evaluates to nonzero (true), statement executes again, but when expression evaluates to zero (false), execution of the loop stops. This type of loop is always executed at least once. Two ways to jump out of a dowhile loop prematurely (that is, before expression becomes false) are the following:
If you execute this program, you get the following output:
|
|