C++ Stacks

The C++ Stack is a container adapter that gives the programmer the functionality of a stack -- specifically, a FILO (first-in, last-out) data structure.


Image Src: Medium


Stack Constructor
  • empty - returns true(1) if the stack has no elements else return false (0)
  • pop - removes an element from the top of a stack
  • push - adds an element to the top of the stack
  • size - returns the number of items in the stack
  • top - returns the top element of the stack
Below is the implementation of the Stack Constructor.

Comments