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);
}
#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: Option A

Join The Discussion