AUTOMATIC STORAGE CLASS

The automatic class is the default storage class for local variable declared with in a function or a block. It automatically assigned to the variable if no storage class is specified the auto.

Variable are created when the block is entered and destroyed when the block is exited.

Storage  ->  memory

Default initial value ->  garbage value

Scope ->  local or with in block or function

Life -> till the control remains with in block in which variables is defined.

Ex

#include<stdio.h>

void main(){

  auto int i, j;

  printf(“%d %d”, i, j);

}

 

#include<stdio.h>

void main()

{

  auto int i=1;{

  auto int i= 2;{

  auto int i=3;

  printf(“%d”, i);

}

  printf(“%d”, i);

}

  printf(“%d ”, i);

}

 Output: 3 2 1