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

Where do I find the current c or c++ standard documents?

0 Answers  


What is a constructor initializer list and when we use constructor initializer list?

3 Answers   Soft Info, TCS,


What is algorithm in c++ programming?

0 Answers  


Differentiate between an array and a list?

0 Answers  


Program to check whether a word is a sub-string or not of a string typed

0 Answers  






How to get the current position of the file pointer?

0 Answers  


What is c++ prototype?

0 Answers  


Tell me what are static member functions?

0 Answers  


Can a constructor throw a exception? How to handle the error when the constructor fails?

1 Answers  


diff between pointer and reference in c++?

1 Answers  


differance between copy & clon

1 Answers   Microsoft,


difference between c and c++?

38 Answers   Cognizant, IBM, Infosys, Oracle, Sarva Shiksha Abhiyan, Wipro,


Categories