Sunday, October 18, 2015

Storage Classes and Linkage in C Programming

Storage Classes and Linkage in C Programming
The storage classes are four types:
1. Auto: Local variable known to only to the function in which it is declared. It is a default storage class.
2. Static: Local variable which exists and retains its value even after the control is to the calling function.
3. Extern: Global variable known to all functions in the life.
4. Register: Local variable which is stored in the register.
There are two types are linkage:
1. External linkage (Global)
2. Internal linkage (Local)
Linkage of Storage Classes:
1. Auto: Internal Linkage.
2. Static: No Linkage.
3. Extern: External Linkage.
4. Register: Not Known.
Points to Remember:
1. All static variables and global variables are static and initialized with zero by default.
2. Static variables can be local.
3. Static, auto and register variables are local variables.
4. Extern variables are global variables.
5. Register variables are never global or static.
6. Register variables can not compute address.

No comments:

Post a Comment