A stack is an abstract data type that holds an ordered, linear sequence of items. In contrast to a queue, a stack is a last in, first out (LIFO) structure.
To implement a stack, you need to maintain a pointer to the top of the stack (the last element to be added).