Values & References1 / 18
Up next

Address-of

const std = @import("std");

pub fn main() void {
    var x: i32 = 7;
    // & yields a pointer to x
    const p = &x;
    x += 1;
    // the pointer sees the updated value
    std.debug.print("{d}\n", .{p.*});
}
What you're solving

& takes the address of a value