Examveda
Examveda

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

A. 1

B. 11

C. 12

D. Error

Answer: Option A

Solution(By Examveda Team)

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).


This Question Belongs to C Program >> C Miscellaneous

Join The Discussion

Comments ( 1 )

  1. Usama Zidan
    Usama Zidan :
    6 years ago

    wouldn't the loop checking evaluate to 1 since 0 ++ is 1 then enter the loop
    ?

Related Questions on C Miscellaneous