What does the following code write to the monitor?
#include <stdio.h> int g = 777; int funct( int a, int b ) { int c=3 ; printf("scope f: a=%d b=%d c=%d g=%d\n", a, b, c, g ); } int main ( void ) { int a=77, b=99 ; funct( 1, 2 ) ; printf("scope m: a=%d b=%d g=%d\n", a, b, g ) ; return 0 ; }
The variable g
has file scope. It may be used anywhere
in the program from where it was declared to the end unless hidden by another identifier g
defined in a block.