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:
- 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.
- 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 ...