ziglings/patches/patches/096_memory_allocation.patch
Chris Boesch 7679f93f68 Converted var to const if there is no mutation in var.
This is checked from compiler version 0.12.0-dev.1664
2023-11-21 15:01:22 +01:00

11 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: ", .{});