← Back to archive

Stdle #61 · arrays · 2026-08-06

What does this Zig snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

const std = @import("std");
pub fn main() void {
const matrix = [2][3]u8{
.{ 1, 2, 3 },
.{ 4, 5, 6 },
};
var sum: u32 = 0;
for (matrix) |row| {
for (row) |val| {
sum += val;
}
}
std.debug.print("{d}\n", .{sum});
}
Arrays
4 attempts left

Answer & explanation