From the course: Master C Language Pointers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Creating a double-linked list - C Tutorial
From the course: Master C Language Pointers
Creating a double-linked list
- [Instructor] Variation on the linked list concept is the Double Linked List, in this approach each structure contains two pointer members. A forward reference and a backward reference. This additional pointer member allows you to move forward and backward in the list, where as a single linked list requires the action always move front to back. Further a last pointer is required, which serves the same function as the first pointer, but from the other end of the list. A Double Linked List requires more overhead, but it's easier to navigate as the code can move back and forth through the list as opposed to moving in one direction only. Behold my implementation of a Double Linked List as shown in this exercise file. The structure definition shown at line nine, has two pointer members, next and previous. These members link the structure to it's neighbors in the list. The list itself is built in the main function in the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Understanding a linked list2m 20s
-
(Locked)
Implementing a linked list3m 36s
-
(Locked)
Removing structures4m 3s
-
(Locked)
Adding structures3m 3s
-
(Locked)
Creating a double-linked list2m 57s
-
(Locked)
Saving a linked list3m 4s
-
(Locked)
Challenge: Manage a linked list2m 13s
-
(Locked)
Solution: Manage a linked list2m 26s
-
-