ExamVeda
Login
Home
This question belongs to C Program Control Structures
Control Structures
?

What will be the output of the given program?
#include<stdio.h>
void main()
{
      int  i=10;
      printf("i=%d", i);
      {
            int  i=20;
	    printf("i=%d", i);
	    i++;
	    printf("i=%d", i);
      }
      printf("i=%d", i);
}

Answer & Solution
Correct Answer: Option C

The scope of second declaration of i is limited to the block in which it is defined. Outside of the block variable is not recognized.

Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.