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 an undefined reference/unresolved external symbol error and how do I fix it?
Discuss the effects occur, after an exception thrown by a member function is unspecified by an exception specification?
What is lvalue?
"How will you merge these two arrays? Write the program Array: A 1 18 22 43 Array: B 3 4 6 20 34 46 55 Output Array: C 1 3 4 6 18 20 22 34 43 46 55"
9 Answers College School Exams Tests, HCL,
What is DlgProc?
Can we declare destructor as static? Explain?
Consider a c++ template funtion template<class T> T& Add(T a, T b){return a+b ;} if this function is called as T c = Add("SAM", "SUNG"); what will happen? What is the problem in the template declaration/ How to solve the problem.
Can comments be nested?
What is meant by entry controlled loop?
0 Answers Agilent, ZS Associates,
What is the default width for ouputting a long integer using the insertion operator?
If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?
Write a function that swaps the values of two integers, using int* as the argument type?