← Back to archive

Stdle #39 · structs · 2026-07-15

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 T = struct { val: u32 };
const arr = [_]T{ .{ .val = 10 }, .{ .val = 20 }, .{ .val = 30 } };
std.debug.print("{d}\n", .{arr[arr.len - 1].val});
}
Structs
4 attempts left

Answer & explanation