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 be the output of the following C code?
#include < stdio.h >
void f();
int main()
{
#define max 10
f();
return 0;
}
void f()
{
printf(“%d\n”, max * 10);
}

What will be the output of the following C code?
#include < stdio.h >
void f();
int main()
{
#define max 10
f();
return 0;
}
void f()
{
printf(“%d\n”, max * 10);
}
a) 100
b) Compile time error since #define cannot be inside functions
c) Compile time error since max is not visible in f()
d) Undefined behaviour

Answer: a

Join The Discussion