Sail E0 Webinar
Question

What would be the output of the following program ?


#include<stdio.h>
int X=40;
int main()
{
int X=40;
{
int X=20;
printf("\n%d", X);
}
printf("%d", X);
return 0;
}
Options:
A .  40 20
B .  20 40
C .  40 40
D .  20 20
Answer: Option B

In case of conflict between local variables the one which is more local gets the priority.




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers