Dereferencing with ptr.*
Read and write through a pointer.
Reaching the Value
A pointer holds an address, not a value. To use the value behind it you must dereference the pointer first.
The .* Syntax
Zig dereferences with a trailing .* on the pointer. So ptr.* means the value that ptr currently points to.
var x: i32 = 7;
const p = &x;
const v = p.*;All lessons in this course
- Single-Item Pointers with *T
- Dereferencing with ptr.*
- Many-Item Pointers [*]T
- Const Pointers and Alignment