Home Segments Index Top Previous Next

681: Mainline

To declare a global variable, you must precede its type specification with the symbol extern. For example, if you want to declare the global variable mode, you include the following declaration:

 *-- Signals declaration, rather than definition 
 | 
 |      *-- Identifies type 
 |      | 
 v      v 
extern int mode; 

Note that you must not include an initial value where extern is used. An initial value forces the C compiler to allocate memory for the variable, thus establishing the variable's definition, which can be done only once.