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.

  1. while (i++ < 100)

it causes next instruction or block following while() executed untill condition goes false (i goes 99).

  1. while(i++<100);

essentially nothing, execpt increasing value of i till 99.


Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -