Skip to content

Instantly share code, notes, and snippets.

View Digi-Cazter's full-sized avatar

Donavan White Digi-Cazter

  • Technologist Group, LLC
  • Montana
View GitHub Profile
@Digi-Cazter
Digi-Cazter / main.zig
Last active March 13, 2024 01:12 — forked from mattfreire/main.zig
Advent of code day 5 - Fix for `attempt to use null value`
const std = @import("std");
const Stack = std.ArrayList(u8);
const Operation = struct { from: u8, to: u8, number: u8 };
pub fn create_stacks(allocator: std.mem.Allocator, stack_count: u8, it: *std.mem.SplitBackwardsIterator(u8, .any)) ![]Stack {
var stacks: []Stack = try allocator.alloc(Stack, stack_count);
for (stacks, 0..) |_, i| {
stacks[i] = Stack.init(allocator);