23


The do-while statement

C's do-while statement has the form:

do

It will execute the enclosed statement(s) as long as expression is true.

For example:

int x=3;

main()

{

}

..outputs:

x=3

x=2

x=1

NOTE: The postfix x-- operator which uses the current value of x while printing and then decrements x.


drago@scri.fsu.edu
Jan. 1997