Curriculum Types Pointers
Pointers
TypeScript has no pointer syntax — everything is a reference under the hood. Zig has dedicated syntax for pointers, and several flavours: *T (single pointer to one T), *const T (read-only single pointer), and — surfaced later in the curriculum — [*]T (many-item pointer, length unknown) and ?*T (nullable single pointer). This theme focuses on the two-flavour core (*T + *const T) since those are the shapes you write every day; many-item and nullable pointers come up in Module 3 (memory) and Module 4 (errors) respectively when their natural use cases arrive. &value takes the address; p.* dereferences. The discipline: pick the narrowest flavour that fits the use case.
9 ready
01
pick oneTypeScript has no separate pointer syntax — passing an object
02
pick oneWhen a function only READS through a pointer (never writes),
03
pick one TypeScript writes & nowhere; you just pass the value. Zig
04
fill blanksFill the missing single character that takes the address of
05
fill blanksFill the two-character postfix sequence that DEREFERENCES a
06
type one line Type the missing Zig line — pass x's address to double,
07
type one line Type the missing Zig line — declare read taking a read-only
08
write a programWrite a complete Zig program that mutates through a pointer:
09
write a programWrite a complete Zig program that READS through a read-only