0

Memory

can anyone explain what is the difference between stack and heap please.

9th Dec 2016, 1:30 PM
AbuAli
AbuAli - avatar
2 Respostas
+ 1
Stack is when memory is allocated at compile time which definitely means that you know the amount of memory to be assigned to a value or anything when the program starts running. Heap is when memory is allocated dynamically at runtime. It means that you dont know the amount of memory that will be used when the program starts running.
9th Dec 2016, 7:25 PM
Franky BrainBox
Franky BrainBox - avatar
0
stack *last in first out data structure *used for pass by value type storage *keeps the original copy of data *static in nature, doesn't permits change heap *it's a tree like data structure *used for pass by reference type data *keeps a reference for the actual data *implemented using pointer and address variables *dynamic in nature
9th Dec 2016, 1:51 PM
Morpheus
Morpheus - avatar