Storage classes in C

Keyword : auto
Storage Location : Stack
Initial Value : Garbage Value
Life : Control remains in a block where it is defined
Scope : Local to the block in which variable is declared


Keyword : register
Storage Location : CPU Register
Initial Value : Garbage
Life : Local to the block in which variable is declared.
Scope : Local to the block


Keyword : extern
Storage Location : if uninitialized then in BSS, if initialized then in Data segment
Initial Value : Zero
Life : Until the program ends.
Scope : Global to the program


Keyword : Static
Storage Location : if uninitialized then in BSS, if initialized then in Data segment
Initial Value : Zero and can be initialize once only
Life : Depends on function calls and the whole application or program
Scope : Local to the block

No comments:

Post a Comment