Stack

The stack stores values in the order it gets them and removes them in the opposite order - [[LIFO (Last In First Out)]].

  • Adding an item in the stack is called as [[Push]].
  • Removing an item in stack is called as [[Pop]].
  • Stack must take up a known, fixed size.

The stack is fast because of the way it accesses the data but in Heap you have to follow a [[pointer]] to get there.

Also, the data on the stack is in a known, fixed size.