Is there a simpler way of doing this? I feel like **Point type that I capture in the loop is weird.
const Point = struct {
x: usize,
y: usize,
};
fn init_points(points: *[]Point) void {
for (points.*, 0..) |*point, i| {
point.* = Point{ .x = i, .y = i };
}
}
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
defer _ = gpa.deinit();
var points: []Point = try allocator.alloc(Point, 10);
defer allocator.free(points);
init_points(&points);
std.debug.print("Points {any}\n", .{points});
}```