Update zig.md: simpler multidimensional arrays

idea from https://www.reddit.com/r/Zig/comments/1ivzd4a/comment/meb8rvq/
This commit is contained in:
Roman Frołow 2025-02-24 13:55:15 +01:00 committed by GitHub
parent 42ff954780
commit ea78a6c198
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

8
zig.md
View File

@ -153,10 +153,10 @@ try some_integers[i]; // Runtime error 'index out of bounds'.
```zig ```zig
const mat4x4 = [4][4]f32{ const mat4x4 = [4][4]f32{
[_]f32{ 1.0, 0.0, 0.0, 0.0 }, .{ 1, 0, 0, 0 },
[_]f32{ 0.0, 1.0, 0.0, 1.0 }, .{ 0, 1, 0, 1 },
[_]f32{ 0.0, 0.0, 1.0, 0.0 }, .{ 0, 0, 1, 0 },
[_]f32{ 0.0, 0.0, 0.0, 1.0 }, .{ 0, 0, 0, 1 },
}; };
// Access the 2D array then the inner array through indexes. // Access the 2D array then the inner array through indexes.