Gracie1st / monty

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is Stack in C?

A stack in C is nothing but a linear data structure that follows the LIFO rule (Last In First Out). In a stack, both insertion and deletion take place from just one end, that is, from the top

In order to better understand it, consider the following scenario: Imagine you have 5 plates that you have to keep on top of each other of distinct colors: Red, Green, Blue, White, and Orange.

You start by placing the red plate on the table. This is the first element of the stack. Then, you place the green plate on top of the red plate. This is the second element of the stack. Similarly, you place the blue plate followed by white and then finally orange. Note that the first plate you inserted into the stack was the red one. Now, you want to remove the red plate. But, before that, you need to remove the rest of the plates that are on top of the red one.

About


Languages

Language:C 92.5%Language:Brainfuck 4.4%Language:MATLAB 1.8%Language:M 0.9%Language:Forth 0.5%