This blog is under construction

Sunday, 13 May 2012

Storage classes in C

The scope and behavior of the variable depends on the type of storage class which is being used.  There are four types of storage classes available in C language.  They are as follows

     1. auto storage class
     2. static storage class
     3. extern storage class
     4. register storage class

auto variables:
Local variables in a function are auto variables.  Auto variables are active inside the block in which they are declared.

register variables:
Frequently used variables are declared as registers.  These register variables are stored in CPU registers for fast access.  This reduces the execution time of the program.

static variables:
Static variables retain their old values even after the execution of function or block is over.

extern variables:
Usually, extern variables are global variables and they are visible to all functions in one or more files.

Let us see more details on the above topics in the forthcoming tutorials.

No comments:

Post a Comment