Wednesday, December 16, 2009

6.1 STORAGE CLASSES

There are two different ways to characterize variables: by data type,and by storage class.Data type refers to the type of information represented by a variable ,e.g. integer number,floating-point number,character etc.Storage class refers to the permanence of a variable,and its scope within the program,i.e. the portion of the program over which the variable is recognized.

There are four different storage class specifications in C: automatic,external,static and register.They are identified by the keywords auto,extern,static and register respectively.

The storage class associated with a variable can sometimes be established simply by the location of the variable declaration within the program.In other situations,however, the keyword that specifies a particular storage class must be placed at the beginning of the variable declaration.

Shown below are several typical variable declarations that include the specification of  a storage class.

auto int a,b,c;
extern float root1,root2;
static int count=0;
extern char star;

No comments:

Post a Comment