0Pricing
Zig Academy · Lesson

A Singly Linked List

Nodes, ownership, and traversal.

What a Linked List Is

A singly linked list chains values together: each node holds a value and a pointer to the next node, or null at the end. 🔗

Define the Node

A node is a struct with a value and an optional pointer to the next node. Optional means the last node points at null.

const Node = struct {
    value: i32,
    next: ?*Node,
};

All lessons in this course

  1. A Generic Stack from Scratch
  2. A Singly Linked List
  3. Using HashMap and AutoHashMap
  4. Profiling and Safety Trade-offs
← Back to Zig Academy