Multiple choice technology programming languages

1)main() { int i = 0; for( ; i++ ; printf(“%d”,i)); printf(“%d”,i); }

  1. 0

  2. 1

  3. infinite loop

  4. 0 1

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

The for loop is: for( ; i++ ; printf('%d',i)). Initial condition is empty (uses i=0). The condition is i++, which is a post-increment: First iteration: i++ evaluates 0 (current value of i), then i becomes 1. Since 0 is false, the loop condition fails immediately. The printf inside the loop never executes. After loop exit, printf('%d',i) outputs 1 (the value of i after the post-increment in the condition check).