How it works...
When implementing a doubly linked list, a structure is defined, called a node, that consists of an integer called data and two pointers, next and prev. Because a doubly linked list can be traversed from either end—that is, forward or backward—the two pointers are required. The next pointer will point at the node after it, whereas the prev pointer will point at the node just before it.
A menu is displayed on the screen showing four options: 1, for creating the doubly linked list; 2, for displaying the elements of the doubly linked list in LIFO order; 3, for displaying elements in FIFO order; and 4, to quit the program.
Let's assume that the user enters 1. The createdoubly function will be invoked. In this function, the startList ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access