Types of storage and scope of each type

Answers were Sorted based on User's Feedback



Types of storage and scope of each type..

Answer / mike

Types of storage class variables in C++:
Automatic.
Extern.
static.

Automatic variables are those which are local to a function
and which are created when the function is called and
destroyed when the function is exited. The memory is
allocated and deallocated on the stack as and when the
function is called and exited.

External variables are global variables and are accessible
to all the functions in the program. They exist throughout
the program.Memory is set when they have have been declared
and will remain till the end of the program.

Static variables are like external varibles which will be
declared within a function and will maintain their values
between function calls.They also exist until throughout the
program

Is This Answer Correct ?    10 Yes 0 No

Types of storage and scope of each type..

Answer / p.mathiazhagan

There four types of storage is available.
1)Automatic
2)external
3)static
4)register

The first three is explained before answer...

Register variable are not using the memory. It stored
in registers. It is mainly used to fast access then
previous storage. But, It has some limitation for declaring
the variable

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Which compiler does turbo c++ use?

0 Answers  


There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.

0 Answers  


What are different types of polymorphism supported by C++

2 Answers   CA, GameLoft,


Hi i need to Acess a variable "int Intval" in the below mentioned code .How to Access it guys i am waiting for your reply

3 Answers  


Difference between const char* p and char const* p?

1 Answers  






What is size of Empty Class?

3 Answers   Persistent,


Tell me difference between constant pointer and pointer to a constant.

0 Answers   Honeywell, Zomato,


Can circle be called an ellipse?

0 Answers  


What is heap sort in c++?

0 Answers  


What is atoi?

0 Answers  


Explain the pure virtual functions?

0 Answers  


What is the use of "new" operator?

0 Answers  


Categories