summaryrefslogtreecommitdiff
path: root/exercises/096_memory_allocation.zig
diff options
context:
space:
mode:
authorChris Boesch <chrboesch@noreply.codeberg.org>2023-11-21 14:26:23 +0000
committerChris Boesch <chrboesch@noreply.codeberg.org>2023-11-21 14:26:23 +0000
commitf987a06cccc47b79e78203870eac443051002895 (patch)
treeb86b2d9f183722cefebec23e10408364aba969bb /exercises/096_memory_allocation.zig
parentb7015c2d9d50da77cf1a3897f84e1b736649beef (diff)
parentb0511bb3c7ac0293edbb68fc54fbd8eba27a5882 (diff)
Merge pull request 'Converted var to const if there is no mutation in the var.' (#28) from var_const into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/28
Diffstat (limited to 'exercises/096_memory_allocation.zig')
-rw-r--r--exercises/096_memory_allocation.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/exercises/096_memory_allocation.zig b/exercises/096_memory_allocation.zig
index 6e818b5..1ece922 100644
--- a/exercises/096_memory_allocation.zig
+++ b/exercises/096_memory_allocation.zig
@@ -52,7 +52,7 @@ fn runningAverage(arr: []const f64, avg: []f64) void {
pub fn main() !void {
// pretend this was defined by reading in user input
- var arr: []const f64 = &[_]f64{ 0.3, 0.2, 0.1, 0.1, 0.4 };
+ const arr: []const f64 = &[_]f64{ 0.3, 0.2, 0.1, 0.1, 0.4 };
// initialize the allocator
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
@@ -64,7 +64,7 @@ pub fn main() !void {
const allocator = arena.allocator();
// allocate memory for this array
- var avg: []f64 = ???;
+ const avg: []f64 = ???;
runningAverage(arr, avg);
std.debug.print("Running Average: ", .{});