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 func();
int main()
{
static int b = 20;
func();
}
void func()
{
static int b;
printf(“%d”, b);
}

What will be the output of the following C code?
#include < stdio.h >
void func();
int main()
{
static int b = 20;
func();
}
void func()
{
static int b;
printf(“%d”, b);
}
a) Output will be 0
b) Output will be 20
c) Output will be a garbage value
d) Compile time error due to redeclaration of static variable

Answer: a

Join The Discussion