Write the difference between Stack and Heap?
Interview question and answer by:
Tripati_tutu | Posted on: 3/23/2011 | Category:
C# Interview questions | Views: 2165 | |
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
Found interesting? Add this to: