This commit is contained in:
Kenneth Brooks 2025-04-18 06:48:56 +02:00 committed by GitHub
commit 8cb1faf1d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

3
zig.md
View File

@ -3,6 +3,7 @@ name: Zig
filename: learnzig.zig filename: learnzig.zig
contributors: contributors:
- ["Philippe Pittoli", "https://karchnu.fr/"] - ["Philippe Pittoli", "https://karchnu.fr/"]
- ["Kenneth Brooks", "https://github.com/zendril"]
--- ---
[Zig][ziglang] aims to be a replacement for the C programming language. [Zig][ziglang] aims to be a replacement for the C programming language.
@ -204,7 +205,7 @@ const slice = array[0..array.len]; // "slice" represents the whole array.
```zig ```zig
// Pointer on a value can be created with "&". // Pointer on a value can be created with "&".
const x: i32 = 1; 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}); print("1 = {}, {}\n", .{x, pointer});
// Pointer values are accessed and modified with ".*". // Pointer values are accessed and modified with ".*".