+ 1

In a do while loop, condition is checked for the value of the variable at beginning of loop or after inc/dec operator?

eg int x=1; do { printf("%d",x); x++; }while(x<5); here for the first execution, will the condition be checked for value of x as 1 in the beginning of the loop, or value 2 after the inc ?

18th Jan 2018, 5:15 PM
Sarala devi CS
1 Réponse
+ 2
After everything in the loop.
18th Jan 2018, 5:33 PM
Jacob Pembleton
Jacob Pembleton - avatar