Storage Classes are used to describe about the features of a variable.
Basically there are four things that will decide the storage classes-
- Default Value
- Memory (Where it Stored)
- Scope (Visibility)
- Life
There are four storage classes in C Language are given bellow -
- Auto
- Static
- Extern
- Register
Auto Storage Classes :-
Default Value :-
- For local variable if we don't specify any storage type, then the compiler will treat that as auto .
- All auto variable are local variable but we can not say all local variable auto variable.
Memory :-
- Auto variable are present in function stack frame.
- Scope of an auto is within a function or within block where it is declared.
- Life of an auto variable start when function execution start and ends when function execution ends.
Re-Initialization is allowed for auto storage class.
We should not catch Auto variable address while returning from the function.
Remaining storage classes will discuss in next post.