Storage class specifiers

A storage class specifier is used to refine the declaration of a variable, a function, and parameters. Storage classes determine whether:
  • The object has internal, external, or no linkage
  • The object is to be stored in memory or in a register, if available
  • The object receives the default initial value of 0 or an indeterminate default initial value
  • The object can be referenced throughout a program or only within the function, block, or source file where the variable is defined
  • The storage duration for the object is maintained throughout program run time or only during the execution of the block where the object is defined
For a variable, its default storage duration, scope, and linkage depend on where it is declared: whether inside or outside a block statement or the body of a function. When these defaults are not satisfactory, you can use a storage class specifier to explicitly set its storage class. The storage class specifiers are:
  • auto
  • static
  • extern
  • register
  • IBM extension __thread