Curriculum Memory ArrayList
ArrayList
ArrayList(T) is Zig's growable slice — your TypeScript Array equivalent. In Zig 0.16 it's an unmanaged container by API convention: you initialize with the .empty literal, pass the allocator on every mutating call (append, insert, etc.), and call .deinit(allocator) to release. items is a []T view into the live elements; the capacity is hidden. The benefit of unmanaged: no per-list allocator pointer overhead, and the list type is a plain struct you can store in a hash map's value.
9 ready
01
pick one TypeScript reaches for const nums: number[] = [] to start
02
pick one TypeScript's nums.push(10) extends the array. Zig's
03
pick one TypeScript reads .length to get a list's size and indexes
04
fill blanksFill the missing field name. The ArrayList exposes its live
05
fill blanksFill the missing method name. The ArrayList exposes this for
06
type one line Type the missing Zig line — initialize nums as an empty
07
type one lineType the missing Zig line — append the integer 30 to the
08
write a programWrite a complete Zig program that builds an ArrayList of
09
write a program Write a complete Zig program that builds an ArrayList(u8)