Question: what is difference between stack and heap memory allocation?
Answer: KEY DIFFERENCE Stack is a linear data structure whereas Heap is a hierarchical data structure. ... 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.