← Back to archive

Stdle #46 · structs · 2026-07-22

What does this Zig snippet output?

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

const std = @import("std");
const Packed3 = packed struct {
x: u4 = 15,
y: u4 = 0,
};
pub fn main() void {
const p = Packed3{};
const byte: u8 = @bitCast(p);
std.debug.print("{d}\n", .{byte});
}
Structs
4 attempts left

Answer & explanation