I'm making my own implementation of linked list, the problem is when i try to set value to node via set method it doesn't changes
Here is my main.zig
const std = @import("std");
const structs = @import("structs.zig");
const allocator = std.heap.page_allocator;
pub fn main() !void {
var list = structs.SinglyLinkedList(i32).init(allocator);
try list.add(10);
try list.add(10);
try list.add(10);
try list.add(50);
try list.add(500);
try list.set(1, 999);
var list_iter = list.iterator();
while (list_iter.next()) |item| {
std.debug.print("item -> {}\n", .{item});
}
}
What am i doing wrong?