Storage Class
Programming Techniques using C
Under the guidance of
Mrs. Sushma Mishra
Submitted by:
Joyce Aiman Parhi
BCA 2nd Semester
Roll no. 20
What is a Storage Class?
Each variable declared in C contains not only a datatype but
a storage class too. If the programmer does not write it explicitly, the C
preprocessor expands the line of code and adds the default storage class
keyword i.e. ‘auto’ to the statement.
Types
● Automatic
● Register
● Static
● External
Features
● Storage
● Life
● Scope
● Default Value
extern
Storage Class
int
Datatype
i
Variable Name
=
Assignment Operator
20
Value
Syntax
Example’s
auto
#include<stdio.h>
#include<conio.h>
void main()
{
auto int i; /* default storage class i.e.
auto */
int a,b; /* Same as writing ‘auto int’
a */
for(i=0;i<100;i++)
{
printf("Hellon");
}
getch();
}
register
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b; /* */
register int i; /* */
for(i=0;i<100;i++)
{
printf("Hellon");
}
getch();
}
static
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b; /* */
static int i; /* */
for(i=0;i<100;i++)
{
printf("Hellon");
}
getch();
}
extern
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b; /* */
extern int i; /* */
for(i=0;i<100;i++)
{
printf("Hellon");
}
getch();
}
Thank You

Storage Class