Question: what is the difference between allocating memory on the heap versus the stack?
Answer: KEY DIFFERENCE Stack variables can't be resized whereas Heap variables can be resized. Stack memory is allocated in a contiguous block whereas Heap memory is allocated in any random order. Stack doesn't require to de-allocate variables whereas in Heap de-allocation is needed.