The word while() in C occurs in two different constructs: in a while-loop
Code:
while (condition)
loop-body;
and in a do-loop:
Code:
do
loop-body;
while (condition);
In a while-loop, the condition is tested, and if
true (non-zero) the body is executed; and then the test is repeated, and the body repeated, until the test is
false (0). So
will result in the body of the loop being executed
forever (or until loop exit is triggered some other way, such as break or return). Whereas
will mean that the body is
not executed at all -- obviously this is not very useful!
In a do-loop, the body is executed
first, and
then the test is evaluated, and the whole is repeated until the test is
false. So
will
also result in the body being repeated forever (or until a break/return is reached), whereas
means the body will be executed just
once. This is most commonly used in macro definitions, to prevent confusion between code generated
by the macro and code immediately
after the macro call { but that's a separate question
}.