From 31edc043d2ff46693ca891611935b8649c209ba3 Mon Sep 17 00:00:00 2001 From: Kenneth Brooks Date: Wed, 22 Jan 2025 15:11:34 -0500 Subject: [PATCH] Addressing wrong type for the pointer example The other option would be to change x from const to var: ``` var x: i32 =1; const pointer: *i32 = &x ``` --- zig.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zig.md b/zig.md index ad56a471..efebbf8b 100644 --- a/zig.md +++ b/zig.md @@ -204,7 +204,7 @@ const slice = array[0..array.len]; // "slice" represents the whole array. ```zig // Pointer on a value can be created with "&". const x: i32 = 1; -const pointer: *i32 = &x; // "pointer" is a pointer on the i32 var "x". +const pointer: *const i32 = &x; // "pointer" is a pointer on the const i32 var "x". print("1 = {}, {}\n", .{x, pointer}); // Pointer values are accessed and modified with ".*".