Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will happen if the following C code is executed?
#include <stdio.h>
int main()
{
int main = 3;
printf(“%d”, main);
return 0;
}

What will happen if the following C code is executed?
#include <stdio.h>
int main()
{
int main = 3;
printf(“%d”, main);
return 0;
}
a) It will experience infinite looping
b) It will cause a run-time error
c) It will run without any error and prints 3
d) It will cause a compile-time error

Answer: c
Explanation: A C program can have same function name and same variable name.
So, Output is 3

Join The Discussion