+ 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?

9th Apr 2019, 2:51 PM
KritZ - avatar
1 Answer
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.
10th Apr 2019, 7:04 PM
Narendra Kumar
Narendra Kumar - avatar