Multiple choice technology programming languages

Find the output of this program. main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

  1. -1

  2. 1

  3. 0

  4. Compiler error

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Tracing the loop: i starts at 0. The condition +(+i--)!=0 uses i before decrement (i=0, i-- makes i=-1 after, but condition uses 0). 0!=0 is false, so loop never executes. After loop, i=-1. The printf outputs -1. The claimed answer A is correct.