0
What is a heap
can you help me, please?
1 ответ
+ 2
Contrast often helps here; the heap is main memory available to your application for long-term use, in contrast to the stack which is short-term. Globals and static variables are stored in the program's heap. Automatic variables used (and reused) within functions appear on the stack.
The stack is 'unstable' while the heap is persistent and long-lasting; if it's set to all zeroes at program start, it should (as in will) be all zeroes when used. There is no such guarantee for the stack.
Here's a longer contrast:
http://www.programmerinterview.com/index.php/data-structures/difference-between-stack-and-heap/