You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ziglings/patches/patches/096_memory_allocation.patch

12 lines
420 B
Diff

--- exercises/096_memory_allocation.zig 2023-11-21 14:55:33.805678390 +0100
+++ answers/096_memory_allocation.zig 2023-11-21 14:56:00.236163484 +0100
@@ -64,7 +64,7 @@
const allocator = arena.allocator();
// allocate memory for this array
- const avg: []f64 = ???;
+ const avg: []f64 = try allocator.alloc(f64, arr.len);
runningAverage(arr, avg);
std.debug.print("Running Average: ", .{});