Define storage classes in C++.
Page 1 of 1
Define storage classes in C++.
Storage class defined for a variable determines the accessibility and longevity of the variable. The accessibility of the variable relates to the portion of the program that has access to the variable. The longevity of the variable refers to the length of time the variable exists within the program.
Auto
Automatic variable, also called as local variable and it has scope only within the function block where it is defined.
External
External variable are defined outside any function and memory is set aside for this type of variable once it is declared and remained until the end of the program. These variables are also called global variables.
Static
The static automatic variables, as with local variables, are accessible only within the function in which it is defined. Static automatic variables exist until the program ends in the same manner as external variables. In order to maintain value between function calls, the static variable takes its presence.
Similar topics
» Explain storage qualifiers in C++.
» What are friend classes? What are advantages of using friend classes?
» What are the advantages of using friend classes?
» What are the C++ standardized container classes?
» What is a container class? What are the types of container classes?
» What are friend classes? What are advantages of using friend classes?
» What are the advantages of using friend classes?
» What are the C++ standardized container classes?
» What is a container class? What are the types of container classes?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|