← Back to archive

Stdle #93 · structs · 2026-09-07

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 Point = struct { x: i32, y: i32 };
const p = Point{ .x = 3, .y = 4 };
const q = Point{ .x = 1, .y = 2 };
const sum = Point{ .x = p.x + q.x, .y = p.y + q.y };
std.debug.print("{d},{d}\n", .{ sum.x, sum.y });
}
Structs
4 attempts left

Answer & explanation