Write the difference between Stack and Heap?

 Posted by Tripati_tutu on 3/23/2011 | Category: C# Interview questions | Views: 17869 | Points: 40
Answer:

Stack:
• Memory will be allocated at the compile time.
• Here the memory is allocated by the compiler.
• Memory will be allocated only in sequential locations.
• The memory will also be deleted by the compiler.
• There is lot of chance of memory wastage.

Heap:
• Memory will be allocated at the run time.
• Here the memory is allocated by the user.
• Memory will be allocated in sequential locations and non- sequential locations.
• The memory must be deleted explicitly by the user.
• There is no chance of memory wastage if the memory is handled perfectly.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response