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 Posted / 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 |
Post New Answer View All Answers
Write a c program for binary addition of two 8 bit numbers.
What do you understand by a pure virtual member function?
Is string an object in c++?
A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.
What are friend functions in C++?
Why do we use pointers in c++?
What is the best c++ compiler for windows 10?
What are activex and ole?
What return value must conversion operators have in their declaration?
What is the difference between an external iterator and an internal iterator?
Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?
Why do we use setw in c++?
What is ios in c++?
What are features of c++?
What are the various compound assignment operators in c++?