Skip to main content

Posts

Showing posts with the label Storage classes in C

Storage classes in C, Scope and Life Time

In C variables are declared by the type of data they can hold. During the execution of the program, these variables may be stored in the registers of the CPU or in the primary memory of the computer. To indicate where the variables would be stored, how long they would exist, what would be their region of existence, and what would be the default values, C provides four storage class specifiers that can be used along with the data type specifiers in the declaration statement of a variable. These four storage class specifiers are  Automatic External Register Static Storage classes specify the scope, lifetime and binding of variables. To fully define a variable, one needs to mention not only its ‘type’ but also its storage class. A variable name identifies some physical location within computer memory, where a collection of bits are allocated for storing values of variable. Storage class tells us the following factors − Where the variable is stored (in memory or cpu register)? What will be