Pointers
Normal pointers in Zig cannot have 0 or null as a value. They follow the syntax
*T
, where T
is the child type.
Referencing is done with &variable
, and dereferencing is done with
variable.*
.
Trying to set a *T
to the value 0 is detectable illegal behaviour.
Zig also has const pointers, which cannot be used to modify the referenced data. Referencing a const variable will yield a const pointer.
A *T
coerces to a *const T
.