Question: what is the difference in c++ between stack and heap memory allocation?
Answer: In a stack, the allocation and deallocation is automatically done by whereas, in heap, it needs to be done by the programmer manually. Handling of Heap frame is costlier than handling of stack frame. Memory shortage problem is more likely to happen in stack whereas the main issue in heap memory is fragmentation.