External Storage Class

When the storage class of the variable is declared extern it has the following features:
-The variable is stored in memory.
-The initial default value of the variable is zero.
-The scope of the variable is global (this means that the variable can be accessed by any function in the program).
-The variable is active and alive as long as the program execution does not come to an end i.e. its life is as long as the program is in execution.
External variable are declared outside all functions, but they are available to all the functions.
An example of declaring external variables is:
extern int a;
float b;
main()
{
:
:
}
fn1()
{
:
:
}
fn2()
{
:
:
}

No comments:

Post a Comment