0Pricing
Zig Academy · Lesson

Dynamic Lists with ArrayList

Grow a buffer backed by an allocator.

A Growable Buffer

Sometimes you do not know the size up front. std.ArrayList is a dynamic array that grows as you add items, backed by an allocator. 📈

It Is Generic

ArrayList is a generic type: you name the element type once, and you get a list of exactly that type with full type safety.

const List = std.ArrayList(i32);

All lessons in this course

  1. Why Zig Has No Hidden Allocations
  2. The Allocator Interface
  3. alloc, free, create, destroy
  4. Dynamic Lists with ArrayList
← Back to Zig Academy