scope in C

The scope of a name is the part of the program within which the name can be used.
The scope of an global variable or a function lasts from the point at which it is declared to the end of the file being compiled.
On the other hand, if an global variable is to be referred to before it is defined, or if it is defined in a different source file from the one where it is being used, then an extern declaration is mandatory.
It is important to distinguish between the declaration of a global variable and its definition. A declaration announces the properties of a variable (primarily its type); a definition also causes storage to be set aside.
There must be only one definition of a global variable among all the files that make up the source program; other files may contain extern declarations to access it. (There may also be extern declarations in the file containing the definition.) Array sizes must be specified with the definition, but are optional with an extern declaration.
Initialization of a global variable goes only with the definition.