Sail E0 Webinar
Question


What will be the output of the program?


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

In case of a conflict between a local variable and global variable, 

the local variable gets 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