Data structures, as is apparent from the name, is a "good" way of holding data. Before attempting to define good, lets see why such a thing is really needed. Every application or program has its set of requirements. Let's take the classic example of a student database at a university. Say, this database needs to hold information like student particulars, staff particulars and course particulars. The data elements student, staff, and course are not trivial elements, they are made of other elements. For instance, the student element is made up of the name element, the age element, and so on. It would make a lot of sense(and a lot of things easy), to hold all the relevant information together. Same is the case with staff element. The structures which help hold such pieces of related information together is called a data structure.
A stack is a data structure that supports first-in-last-out access to elements, meaning the most recently added element is the first to be removed. Stacks have two main operations, namely Push() and Pop(). Push() adds an element to the top of the stack, while Pop() removes the element at the top of the stack. You can think of it as a stack of plates: you can 'push' additional items onto the stack of plates or 'pop' plates from the top of the stack.
A Stack is a data type that only allows users to access the newest member of the list. It is analogous to a stack of paper, where you add and remove paper from the top, but never look at the papers below it.
A typical Stack implementation supports 2 operations: Push(), Pop().
Push() will add an item to the end of the list. This takes constant time.
Pop() will remove the item at the end of the list. This takes constant time.
A stack may be implemented to have a bounded capacity. If the stack is full and does not contain enough space to accept an entity to be pushed, the stack is then considered to be in an overflow state. The pop operation removes an item from the top of the stack. A pop either reveals previously concealed items or results in an empty stack, but, if the stack is empty, it goes into underflow state, which means no items are present in stack to be removed.
A stack is a restricted data structure, because only a small number of operations are performed on it. The nature of the pop and push operations also means that stack elements have a natural order. Elements are removed from the stack in the reverse order to the order of their addition. Therefore, the lower elements are those that have been on the stack the longest.