© Shirish Chavan 2017

Shirish Chavan, C Recipes, https://doi.org/10.1007/978-1-4842-2967-5_8

8. Stacks and Queues

Shirish Chavan

(1)Sangli, Maharashtra, India

A stack is an abstract data structure. Specifically, a stack is a list of elements in which you can insert the elements and also delete the elements from it. This list is open at one end and closed at the other end. The operations of insertion and deletion can be done only from the open end. A stack is also called a last in first out (LIFO) data structure. A stack of dishes in a cafeteria is an example of LIFO. In this stack, the waiter places (inserts) the dishes at the top of the stack, and customers take (delete) the dishes from the top of the stack.

The operations of inserting and deleting ...

Get C Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.