+ 2
What are the differences and functions of heap and stack memory?
2 Respuestas
+ 5
Heap used for Dynamic memory allocation. Ex - ln C, if you allocate memory using malloc(), calloc() functions.
Stack is used to store temporary things like local variables, function call addresses etc.,
0
Stack is working according to LIFO principle: last in first out. If you pop data from the stack you will get the last data you pushed on the stack. You can peek a first data item from the stack without to remove from the stack as well.