x before foo: 8 parameter x: 999 parameter x: 25 x after foo: 8
/* --- fileA.c --- */ int x = 8; /* file scope, external linkage */
/* --- fileB.c --- */ static int x = 444 ; /* file scope, internal linkage */ foo( int x ) /* block scope, no linkage */ { printf("parameter x: %d\n", x ); x = 25; printf("parameter x: %d\n", x ); }
/* --- fileC.c --- */ extern int x ; /* file scope, external linkage */ main() { printf("x before foo: %d\n", x ); foo( 999 ); printf("x after foo: %d\n", x ); system("pause"); }
Comments:
The static int x
in file fileB.c is not actually used.