Académique Documents
Professionnel Documents
Culture Documents
( Characteristics of Variable )
i.e.
automatic .
II. Initial value of Variable III. Scope of Variable IV. Lifetime of Variable i.e. how long variable exists.
auto int a ,b ;
Storage Class Data Type Variable
Four Type of Storage Class in C Language : Automatic Storage Class ( Local Variables ) Register Storage Class Static Storage Class External Storage Class
auto int a ;
Characteristics
Storage Initial Value
Scope or Visibility Life Time
Meaning
Memory Garbage Value i.e. An Unpredictable Value.
Local or Visible in the Block in which it is declared. It retains its value till it is in the block in which it is declared.
Value of m = 10
int i = 0 ;
printf ( \n\n Value of I ..%d,i ) ; i++; }
ck ( ) ;
ck ( ) ; ck ( ) ;
Output
0 0
getch( ) ;
}
Prepared By Vishnu Sharma(MCA) for www.examengine.info
Meaning
C P U Registers Garbage Value Local to the Block in which it is declared It retains its value till the control remains in the block
value even after the execution of the function in which it is declared, then
this storage class is used . It is declared as follow :-
static int a ;
Characteristics
Storage Initial Value Scope or Visibility Life Time
Meaning
Memory Zero ( 0 ) Local to the block in which it is declared It retains its value between the different function calls.
static int i = 0 ;
printf ( \n\n Value of I ..%d,i ) ; i++; } Output
ck ( ) ;
ck ( ) ; ck ( ) ;
getch( ) ;
}
Prepared By Vishnu Sharma(MCA) for www.examengine.info
0
1 2
extern int a ;
Characteristics
Storage Initial Value Scope or Visibility
Meaning
Memory Zero ( 0 ) Global ( Visible in all the Program )
Life Time
a = a + 10 ;
printf ( \n\n Value of a ..%d,a ) ;
int a = 5 ;
printf ( %d , a) ; ck ( ) ;
} Output 5 20
getch ( ) ;
}
Prepared By Vishnu Sharma(MCA) for www.examengine.info