What is a storage class?
The storage class determines the visibility level, life span, variable storage location and the initial value of the variable. If we don’t mention any storage classes for the variables, the C compiler will assume the default storage class for the variable, we have basically two types of storage locations available for the values of the variables to be stored, one is memory and second one is the registers. Depends upon the functionality we use the type of storage classes for the variables.
Types of storage classes available in C language:
· Auto storage class.
· Static storage class.
· Register storage class.
· Extern storage class.
|TYPE OF STORAGE CLASS||INITIAL VALUE||SCOPE||VALIDITY||STORAGE|
|Garbage value||Local||As long as the block executes||Memory|
|Register||Garbage value||Local||As long as the block executes||register|
As long as the program executes value pertains.
|extern||Zero||global||As long as the program executes||Memory|