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 is namespace std; and what is consists of?
What is the object serialization?
If you had the following code: int x = 23; int *y; y = &x; The instruction y++; does what?
What is the first name of c++?
founder of c++
7 Answers Microtek, TCS, TeleCommand,
What happens when you make call 'delete this;'?
Can a built-in function be recursive?
why all c++ program must have default constructor?
Why is polymorphism useful?
How much do c++ programmers make?
What is type of 'this' pointer? Explain when it is get created?
Consider the following code fragment: int main(void) { int m = 4; mystery ( m ); mystery ( m ); printf("%d", m); return 0; } What is the output on the monitor if mystery is defined as follows ? void mystery (int m) { m = m+3; }