c - difference between two different while loops with and without termination? -
whats difference in working of
while(i++<100) and
while(i++<100); is correct in 1st case, i increases until value reach 99 in 2nd case,; error that's why nothing going happen?
in 2nd case,";" error
no. think of while() part of do...while loop. it's perfectly valid.
however, in normal while() loop scenario, both statements valid, behavior different.
while (i++ < 100)
it causes next instruction or block following while() executed untill condition goes false (i goes 99).
while(i++<100);
essentially nothing, execpt increasing value of i till 99.
Comments
Post a Comment