Image

C Language - Storage Classes - Automatic storage class

Storage classes

  1. 1 Automatic storage class(Auto)
  2. 2 External storage class(Extrn)
  3. 3 Static storage class(static)
  4. 4 Register storage class(register)

Automatic storage class(Auto)

Any variable declared within a bracket are comes under auto storage class because they gets memory automatically whenever function is call and they destroy automatically whenever function is destroy.

EX: WAP to use a simple function

#include<stdio.h>
#include<conio.h>
int fun(void);
main(){
int x=5;
clrscr();
printf("\n x = %d ",x);
fun();
getch();
}
int fun(void)
{
int x=6;
printf("\n x = %d ",x);
}

Output

x=5
x=6