Push pop operation using stack in C

What is stack in C programming ?

Stack is one kinds of data structure in which you can push something and pop them reverse order. So the last added item is the first item we can remove. This is also called LIFO (last in first out) operation.
When we add item in stack, it's called push operation. When we remove item from stack, is called pop operation.
Hope the following example make this clear :
Push and Pop operation

Push and pop operation in C language

Push operation :



Initially item = 0. If you push item, item become item++ . So after pushing item, you have to check.If item = = size, show warning. Else scan item and push into the stack. Then increase item by 1 . 

Pop operation :



After pop item from stack, you have to check is there any item in the stack ? If item = = 0, show warning that "Underflow" means stack is empty. Else decrease item by 1. Print popes item.

Full push and pop operation:



Happy coding.......

Related post :

Function Calling in C       Linked List Operations algorithm          Some star pattern coding in C

Push pop operation using stack in C programming. Stack is one kinds of data structure in which you can push something and pop them reverse order. So the last added item is the first item we can remove. This is also called LIFO (last in first out) operation. When we add item in stack, it's called push operation. When we remove item from stack, is called pop operation.Push and pop operation in C language.