What is the Scope,Life time,Default value,Storage of Static,Register,Automatic,Extern variables

Automatic storage class:
Storage : main memory.
Default value : garbage value.
Scope : local to the block in which the variable is defined.
Lifetime : till control remains within the block.

Register storage class:
Storage : cpu registers.
Default value : garbage value.
Scope : local to the block in which the variable is defined.
Lifetime : till control remains within the block.

Static storage class:

Storage : main memory
Default value : zero
Scope : local to the block in which the variable is defined
lifetime : till the value of the variable persists between different function calls.

External storage class:
Storage : main memory
Default value : zero
Scope : global
Lifetime : as long as the program execution doesn't come to an end.

No comments:

 
Top Blogs