Values & References3 / 18
Up next

Read-only pointers

const std = @import("std");

pub fn main() void {
    const n: i32 = 42;
    // *const T can read the pointee but never mutate it
    const p: *const i32 = &n;
    std.debug.print("{d}\n", .{p.*});
}
What you're solving

*const T cannot write through