Loading, please wait...

Storage Classes

The attributes of variables include name, type, size, and value.  we also use identifiers as names for user-defined functions. Actually, each identifier in a program has other attributes, including storage class, storage duration, scope, and linkage.

C provides four storage classes, indicated by the storage class specifiers: auto, register, extern and static. An identifier’s storage class determines its storage duration, scope, and linkage. An identifier’s storage duration is the period during which the identifier exists in memory. Some exist briefly, some are repeatedly created and destroyed, and others exist for the entire execution of a program. An identifier’s scope is where the identifier can be referenced in a program. Some can be referenced throughout a program, others from only portions of a program. An identifier’s linkage determines for multiple sources-

file program whether the identifier is known only in the current source file or in any source file with proper declarations.

 The four storage-class specifiers can be split into two storage durations: automatic storage duration and static storage duration.

Keywords auto and register are used to declare variables of automatic storage duration. Variables with automatic storage duration are created when the block in which they’re defined is entered; they exist while the block is active, and they’re destroyed when the block is exited.