0
Memory allocation
what is stack, heap , null etc etc!! I am unable to understand properly please explain clearly!
2 Answers
+ 3
Stack- a portion of memory which shrinks or grows by pushing or popping values/pointers. Think of it like a stack of plates. Each time you add a plate, it gets bigger, and you take the very top plate off first.
Your compiler takes care of the stack for you, since it has all the information it needs when you compile.
Heap- Memory that is given to you dynamically at run time by the operating system if there are no availible pages of memory already allocated to your process at that time. When you call new, it returns a pointer to a block of memory that is at least the minimum size of bytes you requested. If there isnt enough memory availble, it gives you a null pointer.
Null- It means the pointer points to nothing or the variable contains no data.
0
I understood that in couple of mins after posting. Still thank you for your support !!! You made it more clear.