Storage Classes are used to determine in which space the value of variable will Stored. And what will be the value of variable, when we doesn’t Specify the value of variable. And In what Place we can use the value of variable. The Storage Classes Determines the Following things.
1) Variable: Where the Value of variable will be Stored. In the Memory or in the Registers. Because the Value which is Stored in the Registers will fastly Accessed, Generally value of a variables is Stored into the Memory. The Registers are near to the CPU So that value which is given by user recently is Stored into the Registers.
2) Default Value: The Storage Class also determines what will be the value of the variable, if doesn’t Specified by a user. Means default value of the user. The Default value of the variable may either a 0 or a garbage value which is specified by the Computer.
3) Scope: The Storage Classes also determines where we can use the value of the variable Means what is the Scope of the variable.
There are two Types of Variables in C++ Language
1) Local Variable.
2) Global or External variables
The Local Variables are those which are declared in the Main function or in the Simple Function. The variables those are declared in the Function will never be accessed by Main Function and also vice versa. So that the Local variables those are declared Within a Block and the variables are accessed in the Block only, not from outside the Function. And not in other Functions.
Global variables: The Global variables are those which are accessed by any Function whether it is a Main Function or whether in any function So that the Global variables are those which are accessed from any Function. And the Functions those are Global Scope Accessed by any Function and in any Function we Can Specify the value of variable.
There are four types of Storage Classes those are as Followings: —
1) Automatic Storage Classes: The Automatic Storage Class Specifies that
Value of Variable Will be Stored into the Memory.
Default value: if we don’t specify the value to the variable, then this will accept the Default value as a Garbage Value.
Local Scope: The variables those are declared as Automatic will have a Local Scope Means we can Access the Value only that Location, where we have declared that variable.
If we don’t Specify Any Class, then this is the default Class and this class always takes an auto Keyword.
Static Storage Class
Value of Variable Will be Stored into the Memory.
Default value: if we don’t specify the value to the variable, then this will accept the Default value as a 0.
Local Scope: The variables those are declared as Static will have a Local Scope Means we can Access the Value only that Location, where we have declared that variable.
Registers Storage Class
Value of Variable Will be Stored into the Registers rather than Memory.
Default value: if we don’t specify the value to the variable, then this will accept the Default value as a Garbage Value.
Local Scope: The variables those are declared as Register have a Local Scope Means we can Access the Value only that Location, where we have declared that variable.
External Storage Class
Value of Variable Will be Stored into the Memory.
Default value: if we don’t specify the value to the variable, then this will accept the Default value as a Garbage Value.
Global Scope: The variables those are declared as External will have a Global Scope Means we can Access the Value in any Location, means we access that variable in the Main Function or in any Function.
If we don’t Specify Any Class, then this is the default Class and this class always takes an auto Keyword.
Storage Classes are used to determine in which space the value of variable will Stored. And what will be the value of variable, when we doesn’t Specify the value of variable. And In what Place we can use the value of variable. The Storage Classes Determines the Following things
1) Variable: Where the Value of variable will be Stored. In the Memory or in the Registers. Because the Value which is Stored in the Registers will fastly Accessed, Generally value of a variables is Stored into the Memory. The Registers are near to the CPU So that value which is given by user recently is Stored into the Registers.
2) Default Value: The Storage Class also determines what will be the value of the variable, if doesn’t Specified by a user. Means default value of the user. The Default value of the variable may either a 0 or a garbage value which is specified by the Computer.
3) Scope: The Storage Classes also determines where we can use the value of the variable Means what is the Scope of the variable.
There are two Types of Variables in C++ Language
1) Local Variable.
2) Global or External variables
The Local Variables are those which are declared in the Main function or in the Simple Function. The variables those are declared in the Function will never be accessed by Main Function and also vice versa. So that the Local variables those are declared Within a Block and the variables are accessed in the Block only, not from outside the Function. And not in other Functions.
Global variables: The Global variables are those which are accessed by any Function whether it is a Main Function or whether in any function So that the Global variables are those which are accessed from any Function. And the Functions those are Global Scope Accessed by any Function and in any Function we Can Specify the value of variable.
There are four types of Storage Classes those are as Followings: —
1) Automatic Storage Classes: The Automatic Storage Class Specifies that
Value of Variable Will be Stored into the Memory.
Default value: if we don’t specify the value to the variable, then this will accept the Default value as a Garbage Value.
Local Scope: The variables those are declared as Automatic will have a Local Scope Means we can Access the Value only that Location, where we have declared that variable.
If we don’t Specify Any Class, then this is the default Class and this class always takes an auto Keyword.
Static Storage Class
Value of Variable Will be Stored into the Memory.
Default value: if we don’t specify the value to the variable, then this will accept the Default value as a 0.
Local Scope: The variables those are declared as Static will have a Local Scope Means we can Access the Value only that Location, where we have declared that variable.
Registers Storage Class
Value of Variable Will be Stored into the Registers rather than Memory.
Default value: if we don’t specify the value to the variable, then this will accept the Default value as a Garbage Value.
Local Scope: The variables those are declared as Register have a Local Scope Means we can Access the Value only that Location, where we have declared that variable.
External Storage Class
Value of Variable Will be Stored into the Memory.
Default value: if we don’t specify the value to the variable, then this will accept the Default value as a Garbage Value.
Global Scope: The variables those are declared as External will have a Global Scope Means we can Access the Value in any Location, means we access that variable in the Main Function or in any Function.
If we don’t Specify Any Class, then this is the default Class and this class always takes an auto Keyword.