+ 5
what is the difference between heap and stack?
6 ответов
+ 3
when you use "new" keyword to allocate memory it would be done in heap..
when you use any data types to allocate memory they would be in stack..
+ 2
@kiran how do they function?
+ 1
A heap is a data structure and A stack is abstract data types(mathemetical model for a data structure).
+ 1
whenever you want to store data dynamically and free the data you have to allocate memory on runtime...when you does..this data stores in heap memory area.
whatever you declare the variables while coding those would store in stack area and are automatically deallocated.
+ 1
@kiran only a difference in name??
+ 1
@Maths : in the systems logical memory area also different for heap and stack