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 Name Decoration?
Does c++ have finally?
Why isn't sizeof for a struct equal to the sum of sizeof of each member?
What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor
Can we overload operator in c++?
What is flush c++?
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element array? (Or go to lunch...) a) Quicksort b) Linear Search c) Bubble Sort
Why do we need function?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
What are all predefined data types in c++?
What does catch(…) mean?