Interview Question
Qus: What is a stack? What is a heap? Give the differences between the two?
Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM. Variables allocated on the heap have their memory allocated at run time and accessing this memory is a bit slower, but the heap size is only limited by the size of virtual memory.
Answers (2)
Check this link for the differences