What does the following write to the monitor?
/* --- fileA.c --- */ int x = 8;
/* --- fileB.c --- */ #include <stdio.h> static int x = 444 ; void foo() { printf("x in fileB: %d\n", x ); x = 25; printf("x in fileB: %d\n", x ); }
/* --- fileC.c --- */ #include <stdio.h> void foo(); extern int x ; void main() { printf("x before foo: %d\n", x ); foo(); printf("x after foo: %d\n", x ); }
As usual, pay attention to how many x
's there are and
where they are visible.