Why for local variables the memory required to hold the
variable is allocated from the program stack and for new
its allocated from the heap?
Answer / achal ubbott
* Stack is a kind of data structure where Last In FirstOut
work. Local variables are needed for a short span of time
for immediate processing. So push and pop from stack is
used for them. Now memory is allocated to them in static
time only.
* new() operator allocates memory dynamically. Since
objects are needed for more time, space is taken from heap.
Is This Answer Correct ? | 2 Yes | 0 No |
What are the manipulators in c++?
What is stream and its types in c++?
If all is successful, what should main return a) 0 b) 1 c) void
Which software is used for c++ programming?
How can I improve my c++ skills?
what are the iterator and generic algorithms.
What is the standard template library (stl)?
Is c++ double?
What is the Difference between "vector" and "array"?
15 Answers Covansys, Gambit, TCS, Wipro,
How can an improvement in the quality of software be done by try/catch/throw?
Can you please explain the difference between static and dynamic binding of functions?
Is arr and &arr are same expression for an array?