ExamVeda
Login
Home
This question belongs to C Program C Miscellaneous
C Miscellaneous
?

Determine Output:
void main()
{
      int i=0;
      for(;i++;printf("%d", i));
      printf("%d", i);
}

Answer & Solution
Correct Answer: Option A

Before entering into the for loop checking condition is "evaluated". Here it evaluates to 0 (false) and comes out of the loop, and i is incremented (note the semicolon after the for loop).

Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Usama Zidan
Usama Zidan 9 years ago
wouldn't the loop checking evaluate to 1 since 0 ++ is 1 then enter the loop
?