Printing Zig Structs (opens in new tab)
I recently found a new way to print formatted strings in Zig. If you’ve spent much time with the language, you’ve probably tried to print something to a console or other output. Here’s an example of what that can look like in Zig 0.16.0: const std = @import("std"); pub fn main(init: std.process.Init) !void { const io = init.io; const stdout_handle = std.Io.File.stdout(); var buf: [128]u8 = undefined; var stdout = stdout_handle.writer(io, &buf); const time = "afternoon"; const name = "Edward";...
Read the original article