Learning Zig from the official language reference.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
zig-langref/multidimensional_arrays.zig

14 lines
379 B

const std = @import("std");
const debug = std.debug;
// Zig cannot infer the size here
const matrix = [3][3]f32{ [_]f32{ 1.2, 2.3, 3.4 }, [_]f32{ -2.3, -3.2, -0.22 }, [_]f32{ 0.09, 1312.232, -12212.22 } };
test "multi-dimensional arrays" {
for (matrix) |row| {
for (row) |e| {
debug.print("{} ", .{e});
}
debug.print("\n", .{});
}
}