Step Into C · Lesson 33 · Capstone
Final Project: Linked Lists
Self-referential structs, heap nodes, removal, cleanup, and Windows-style LIST_ENTRY lists.
- ~45 minreading and coding
- 5missions
- membersaccess
- Clanguage
Part of Step Into C. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.
This last lesson combines structs, pointers, the heap, typedefs and careful memory ownership into the data structure you will see everywhere in systems code: the linked list.
In this lesson
- Putting it all together
- The idea
- Declaring a node
- Creating and linking nodes
- Walking the list
- Removing a node
- Freeing the whole list
- The Windows way: intrusive lists
- Where to go next
Missions
- Build and print
- Length and search
- Remove a node
- Clean up after yourself
- LIST_ENTRY and CONTAINING_RECORD