← Back to archive

Stdle #111 · structs · 2026-09-25

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 { a: u32 = 10, b: u32 = 20, c: u32 = 30 };
const obj = T{};
std.debug.print("{d}\n", .{@field(obj, "b")});
}
Structs
4 attempts left

Answer & explanation