How to do it...

In this doubly linked list, I will be making use of two pointers, startList and endList, where startList will point at the first node and endList will point at the last node. The startList pointer will help to traverse the list in FIFO order, while the endList pointer will help to traverse it in LIFO order. Follow these steps to create a doubly linked list and traverse it in either direction:

  1. Define a structure called node. To store content for the doubly linked list, define a data member in the node structure. Define two pointers called next and prev.
  2. A menu is displayed that shows four options: 1, to create a doubly linked list; 2, to display the elements of the list in LIFO order; 3, for displaying the elements in FIFO ...

Get Practical C Programming 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.