adplus-dvertising
frame-decoration

Question

Comment on the output of this 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

Posted under C Programming

Answer: (a).Output will be 0

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Comment on the output of this C code? #include <stdio.h> void func(); int main() { static int b = 20; func(); } void func()...