Sail E0 Webinar
Question

What would be the output of the following program ?



#include<stdio.h>
int X=40;
int main()
{
int X=20;
printf("%d\n", X);
return 0;
}


Options:
A .  20
B .  40
C .  Error
D .  No output
Answer: Option A

Whenever there is 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