External Storage Class, C Language Assignment Help

Assignment Help: >> Storage Classes in C Language >> External Storage Class, C Language

External Storage Class

 When you are declaring the variables as external storage class, it is accessed in all the functions which is defined in the same program. The variables are called extern or global variables. External variables are declared outside the function body. In case both external and auto variables are declared with the same name in a program the first priority is given to the auto variable. In this case external variable remain hidden.

S.No.

Features of External Variable

Meaning

1.

Storage or location of variable

Memory

2.

Initial or default value

Zero

3.

Scope of the variable

Global

4.

Life of the variable

As long as the program's execution doesn't come to the end of the program.

Example of External Storage Class

#include<stdio.h>

#include<conio.h>

int num=5;

main()

{

                int num=20;

                printf("\t%d",num);

                display();

}

display()

{

                printf("\t%d",num);

}

Output: 20          5

Explanation: In this program, first the value of local variable is printed i.e. 20. When display () function is called it will print the global value of variable num i.e. 5.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd