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


Please Help Members By Posting Answers For Below Questions

What does h mean in maths?

560


How do you clear a buffer in c++?

527


Write a program to interchange 2 variables without using the third one.

578


In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....

1933


Can create new c++ operators?

562






Explain the use of this pointer?

630


What are references in c++? What is a local reference?

567


What are the main features of c++?

534


Can I create my own functions in c++?

588


Why use of template is better than a base class?

636


Difference between overloaded functions and overridden functions

568


What is class in c++ with example?

562


What are multiple inheritances (virtual inheritance)?

571


Can you please explain the difference between using macro and inline functions?

515


what is oops and list its features in c++?

536