Automatic variables and variables scoping - cont.
External or Global variables - variables declared outside functions, and can be used and changed by several functions
External variables always exist and retain their value until the entire program is terminated
Provide a way for function to communicate
a function can use a variable if it was - defined earlier in the file- declared extern earlier in the file- declared extern in the function
/*file1.c*/ int my_count = 0; char * foo();
/*file2.c*/ extern int my_count;extern char *foo(); … my_count++;