+ 3
Heap & Stack
How can heap and stack be used? I only know mainly the fundamentals, so itâs kinda hard to try to comprehend peopleâs examples of heap and stack. Can someone simply it?
3 Answers
0
Stack and heap both are part of memory layout of any program.
When we allocate memory dynamically( like malloc in c),
Then it is allocated in heap.
And function parameters, local variables, return addresses are allocated in stack.