What are the basics of classifying different storage types,
why?
Answer Posted / prit
The different storage types in C++ are
Auto: all the variables declared in C++ are of the type
auto by default
The scope is limited to the loop
int temp; //is by default of type auto
Register: tels the C++ compiler to allocate some storage in
the registers.They are supposed to be faster then other
storage types.
register int var;
Only nonstatic, local variables may reside in registers,
and C++ uses the same rules for register variable scope and
initialization as it does with automatic variables
Mutable:const memebre functions or data types can be
modified using mutable keyword.
mutable int i;
static:static variable is declared as a member of a class,
then it will preserve the value for all the objects of the
class.i.e, one copy of this data variable will be shared by
all objects of the class.
static int temp;
extern : extern keyword is used to specify that the
variable is declared in a different file.Used mostly to
declare global scope
extern int num;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a rooted hierarchy?
How java is different from c and c++?
What is the use of namespace std in C++?
What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number
Is oops and c++ same?
What do the header files usually contains?
C is to C++ as 1 is to a) What the heck b) 2 c) 10
Do inline functions improve performance?
what is a reference variable in C++?
How do c++ struct differs from the c++ class?
Why c++ is called oop?
What are the benefits of pointers?
What is vectorial capacity?
What is virtual destructor? What is its use?
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?