Heap & Stack | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
KritZ - avatar
2 Answers
10th Apr 2019, 2:29 PM
Sonic
Sonic - avatar
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.
10th Apr 2019, 7:04 PM
Narendra Kumar
Narendra Kumar - avatar