posted 22 years ago
do-while loop executes its body atleast once irrespective of whether the condition returns true/false
i gets incremented to 2
goes thru the condition in while
b= !b
in this statement,! has higher precedence than =.
!b evaluates to !false ==> true
now b gets assigned the value true.
(b = (!false)) -> true
since the condition returns true,it enters the loop again,and increments i to 3.
Now,the condition is evaluated once again,
but returns false (because b = (!true) )therefore comes out of the loop and prints 3.
Chitra