Class |
Duration |
Description |
Scope |
Automatic |
temporary |
Declared within a function with no keyword or keyword auto. |
Confined to the block in which it is declared. |
External |
persistent |
Declared outside of any functions or within a function with keyword extern. |
Global after point at which it is declared. |
Static |
persistent |
Declared with keyword static either within or outside a function. |
If declared within a function it is local to the function.
If declared outside functions it is global within that module. |
Register |
temporary |
Declared with keyword register. |
A register variable is local to the function in which it is declared.
Declaring a variable register does not necessarily mean
it will be stored in a CPU register. |