Syntax:
do
operator
while (expression);
If the expression is True, then the operator will be executed and the expression value will be calculated. This will be repeated until the expression becomes False.
If the expression is False, then control is passed to the next operator.
Note. The expression value is determined after the operator is executed. Therefore, the operator is executed at least once.
The do-while operator checks the condition in the end of the cycle.
The while operator checks the condition in the beginning of the cycle.
Example:
x = 1;
do
printf('%d\n", pow(x, 2));
while (++x <= 7);
|