External Storage class

When a variable is declared as extern, it is stored in the memory. The extern keyword is used before a variable to inform the compiler that this variable is declared somewhere else. The extern declaration does not allocate storage for variables. The default value is initialized to zero. The scope of the variable is global and the life of the variable is until the program execution comes to an end. To define a variable as external storage class, the keyword „extern‟ is used. An extern variable is also called as a global variable. Global variables remain available throughout the entire program. One important thing to remember about global variable is that their values can be changed by any function in the program.
Systax : extern data_type variable_name;
Ex : extern int i;


Program Output