1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Storage Classes

  • Storage classes are used for two purposes in C:
  • control the visibility of a name
  • specify how storage is allocated for a variable
  • There are 4 storage classes:
  1. auto
  2. static
  3. extern
  4. register


Declarations and Definitions

  • Recall the difference between a declaration and a
    definition
  • A declaration states that a name exists and how it can
    be used - a procedure declaration gives the name of the
    procedure, its return type and optionally the types of its
    parameters
  • A declaration only tells the compiler that the procedure
    or variable exists, and will be defined elsewhere--the
    compiler doesn't create the procedure or variable
  • A definition contains all the information that a
    declaration does, plus it creates the procedure or variable

March3, 1998

Page 14

C201/TAM