Stack in C

Advertisements

Prev Tutorial Next Tutorial

Stack in C

Stack is linear data structure. In stack addition of new data item and deletion of already existing data item is done from only one end, known as top. Working of stack on the basis of Last-in-First-out (LIFO) principal, it means last entered item remove first.

stack

Working of Stack in C

A stack is a container of objects that are inserted and removed according to the Last-in First-Out (LIFO) principle. Both operation insert and deletion perform in stack only from TOP.

Real life example of stack

A most popular example of stack is plates in marriage party. Fresh plates are pushed onto to the top and popped from the top.

stack real life example

Stack Operation

In stack data structure mainly perform two operation; push and pop

  • pop: In case of stack deletion of any item from stack is called pop.
  • push: In case of stack Insertion of any item in stack is called push.

Use of stack

  • Expression evaluation
  • Backtracking (game playing, finding paths, exhaustive searching)
  • Memory management, run-time environment for nested language features.
  • To reverse a word. You push a given word to stack - letter by letter - and then pop letters from the stack.
  • An "undo" mechanism in text editors; this operation is accomplished by keeping all text changes in a stack.
  • space for parameters and local variables is created internally using a stack.
  • compiler's syntax check for matching braces is implemented by using stack.
  • Back/Forward on browsers are perform using stacks.

Prev Tutorial Next Tutorial

Advertisements

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Download Projects

Advertisements


Buy Websites 9999595223

Buy Fresh and Payment Receive Media.net Account with Website. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs