"Applying the specifier static to a global variable instructs the compiler to create a global variable known only to the file in which it is declared. This means that even though the variable is global, routines in other files have no knowledge of it and cannot alter its contents directly, keeping it from side effects." - C: The Complete Reference, by Herbert Schildt.
Contents of "staticgl.c"
for (i=0; i<5; i++)
printf("%d %d\n", counter++, nextnumber()); /*How could it possible.*/
Contents of "static.h", Header file used in "staticgl.c".
static int counter;
void startat(int x)
How the main() function in another file can access the 'counter' variable? I am using Turbo C 2.0 compiler.