Storage Duration
Two types of static storage duration are described in the C language:
static storage duration
-
An object declared with external or internal linkage, or with the storage-class specifier static
has static storage duration. For such an object, storage is reserved and its stored valuye is
initialized only once, prior to program startup. The object exists and retains its last-stored value
throughout the execution of the entire program.
automatic storage duration
-
An object whose identifier is declared with no linkage and without the storage-class specifier static has
automatic storage duration. Storage is reserved for a new instance of such an object on
each normal entry into the block with which it is associated, or on a jump from outside the block to a
labeled statement in the block or in an enclosed block. If an initialization is specified for the value stored in
the object, it is performed on each normal entry, but not if the block is entered by a jump to a labeled
statement. Storage for the object is surrendered when execution of the block ends in any way and any attempt
to access the value of the object through a pointer will result in undefined behaviour.
Index