Sail E0 Webinar
Question
What will happen if the below program is executed?
int main()
{
int main = 3;
printf("%d", main);
return 0;
}
Options:
A .  It will cause a compile-time error
B .  It will cause a run-time error
C .  It will run without any error and prints 3
D .  It will experience infinite looping
Answer: Option C


A C program can have same function name and same variable name.
$ cc pgm3.c
$ a.out
3



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers