What is a heap | Sololearn: Learn to code for FREE!
0

What is a heap

can you help me, please?

11th Dec 2016, 3:41 PM
Abdulrahman Ahmad Ka'bar
Abdulrahman Ahmad Ka'bar - avatar
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/
11th Dec 2016, 4:22 PM
Kirk Schafer
Kirk Schafer - avatar