Push pop operation using stack in C

What is stack in C programming?

The stack is one kind of data structure in which you can push something and pop them in 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 items in stock, it's called push operation. When we remove the item from the stack, is called pop operation.
Hope the following example makes this clear:

Push and Pop operation

Push and pop operation in C language

Push operation:



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

Pop operation:


Happy coding...

Related post:

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

0/Post a Comment/Comments