adplus-dvertising
frame-decoration

Question

What is the output of this C code?
#include <stdio.h>
    int main()
    {
        foo();
        foo();
    }
    void foo()
    {
        int i = 11;
        printf("%d ", i);
        static int j = 12;
        j = j + 1;
        printf("%d\n", j);
    }

a.

11 12 11 12

b.

11 13 11 14

c.

11 12 11 13

d.

Compile time error

Posted under C Programming

Answer: (b).11 13 11 14

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this C code? #include <stdio.h> int main() { foo(); foo(); } void foo() { int i = 11;...