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

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -