External Storage Class in C Programming

o Keyword : extern
o Storage Location : Main memory
o Initial Value : Zero
o Life : Until the program ends.
o Scope : Global to the program.

Syntax :

	extern [data_type] [variable_name];

Example :

	extern int a;

The variable access time is very fast as compared to other storage classes. But few registers are available for user programs.

The variables of this class can be referred to as ‘global or external variables.’ They are declared outside the functions and can be invoked at anywhere in a program.

Program :

/*  Program to demonstrate external storage class.
Creation Date : 06 Nov 2010 11:15:04 PM
Author : www.technoexam.com [Technowell, Sangli] */

#include <stdio.h>
#include <conio.h>

extern int i=10;
int main(void)
	int i=20;
	void show(void);
	printf("\n\t %d",i);
	return 0;
void show(void)
	printf("\n\n\t %d",i);

Output :



Leave A Comment

Your email address will not be published. Required fields are marked *