stack is used to store variable data of fixed length.
stack is LIFO ie one the last item in stack is first served and also removed first.
Heap is used to store data whose size and length can only be determined at runtime and are subjected to change.
But a reference to that data is stored on the stack.
so anything in our Heap can be accessed at any time.