Storage Class in C

          Storage Class in C Programming 

                                              (variable storage class)

 

 

                     From compiler point of view, a variable name identify some physical location in any computer when a string of bits representing a variables value stored. There are basically two kind of location in computer where such values are stored -

1. CPU Registers

2. Main Memory 

                      It is variable storage class that determine in which of these two types of location, a value  is stored.  There are basically four types of storage class in C language-

1. Automatic Storage Class

2. Register Storage Class 

3. Static Storage Class

4. External Storage Class

                       Storage classes tell us about -

1. When a variable to be store.

2. What will be the initial value of variable (If initial value is not assigned).

3. Scope and life of variable.

1. Automatic Storage Class

                                     A feature of variable define to have automatic storage class are -

1. There data stores in Main Memory.

2. Its default initial value is Garbage value.

3. Scope of Automatic storage class is local to the block where variable is defined.

4. Its life is till the control remains in that block where it is defined.

5. Keyword of this storage class is 'auto'.

2. Register Storage Class

                                    A feature of variable define to have register storage class are-

1. There data stores in CPU registers.

2. Its default initial value is garbage value.

3. Scope of Register storage class is local to the block where variable is defined.

4.  Its life is till the control remains in that block where it is defined.

5. Keyword of this storage class is 'register'.

3. Static Storage Class

                                       A feature of variable define to have static storage class are-

1. There data stores in Main Memory.

2. Its default initial value is 0 (zero).

3.  Scope of Static storage class is local to the block where variable is defined.

4. Its life is where the variable's value persist between function call.

5. Keyword of this storage class is 'static'.

4. External Storage Class

                                     A feature of variable define to have external storage class are-

1. There data stores in Main Memory. 

2. Its default initial value is 0 (zero).

3. Scope of External storage class is global.

4. Its life is as long as program executed result come to end.

5. Keyword of this storage class is 'extern'.


                                    Thanks for reading, Hope you learned or enjoyed this.

 

 




Comments

Popular posts from this blog

Computer Viruses

Performing Analysis on Meteorological Data

How Education Can Reduce Corruption