+ 3

Anyway explain the below code..how the output became 0 -1 0

{ int a =-1,b=-1,c; c=++a&&b++; cout << a<<endl<<b<<endl<<c; } output----> 0 -1 0

24th Jun 2017, 3:41 PM
MUʜAMMED ÉȘʟʟYAS
MUʜAMMED ÉȘʟʟYAS - avatar
1 Answer
+ 4
++a&&b++ a is incremented by 1 a=0 0 is false so the whole statement would be false So the other side (b++) is skipped b is still -1 and c is set to 0
24th Jun 2017, 4:46 PM
ChaoticDawg
ChaoticDawg - avatar