External ( extern ) storage class in C Programming
- Variables of this storage class are "Global variables"
- Global Variables are declared outside the function and are accessible to all functions in the program
- Generally , External variables are declared again in the function using keyword extern
- In order to Explicit declaration of variable use 'extern' keyword
extern int num1 ; // Explicit Declaration
Features :
Storage | Memory |
Scope | Global / File Scope |
Life time |
|
Default initial Value | Zero |
Live Example :
int num = 75 ;
void display();
void main()
{
extern int mum ;
printf("\nNum : %d",num);
display();
}
void display()
{
extern int mum ;
printf("\nNum : %d",num);
}
Output :
Num : 75
Num : 75
Note :
- Declaration within the function indicates that the function uses external variable
- Functions belonging to same source code , does not require declaration (no need to write extern)
- If variable is defined outside the source code , then declaration using extern keyword is required

Tags / Keywords : | automatic storage class, Extern, extern storage classes, External ( extern ) storage class in C Programming, Register, static, Storage Classes : Introduction
0 Comments:
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email