exercises/patches/patches/096_memory_allocation.patch

11 lines
416 B
Diff

--- exercises/096_memory_allocation.zig 2023-10-03 22:15:22.125574535 +0200
+++ answers/096_memory_allocation.zig 2023-10-05 20:04:07.276104333 +0200
@@ -64,7 +64,7 @@
const allocator = arena.allocator();
// allocate memory for this array
- var avg: []f64 = ???;
+ var avg: []f64 = try allocator.alloc(f64, arr.len);
runningAverage(arr, avg);
std.debug.print("Running Average: ", .{});