Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?



Why for local variables the memory required to hold the variable is allocated from the program sta..

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

Post New Answer

More C++ General Interview Questions

Should the this pointer can be used in the constructor?

0 Answers  


How do we balance an AVL Tree in C++?

0 Answers   Impetus,


Write about the retrieval of n number of objects during the process of delete[]p?

0 Answers  


Explain selection sorting. Also write an example.

0 Answers  


Explain stack & heap objects?

0 Answers  


Write syntax to define friend functions in C++.

0 Answers   HAL,


C is to C++ as 1 is to a) What the heck b) 2 c) 10

0 Answers  


How do you find out if a linked-list has an end?

0 Answers  


Where the memory to the static variables is allocated?

0 Answers  


What are the vectors in c++?

0 Answers  


what are the events occur in intr activated on interrupt vector table

0 Answers   HGS,


Is c++ a high level language?

0 Answers  


Categories