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

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.