From 4f96fa639d9d700459928c85d7889ed3ca2a7a8a Mon Sep 17 00:00:00 2001 From: Nicholas Schwab Date: Wed, 14 Aug 2024 19:41:01 +0200 Subject: [PATCH] fix: The arguments of the commented out linkElephants call are in the wrong order to demonstrate the wanted behavior. It is intended to show that the .? operator will panic if it is called on null, but the null elephant is passed as the second argument which may be null (and on which .? is not called). --- exercises/046_optionals2.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/046_optionals2.zig b/exercises/046_optionals2.zig index 86654f7..e01b88c 100644 --- a/exercises/046_optionals2.zig +++ b/exercises/046_optionals2.zig @@ -38,7 +38,7 @@ pub fn main() void { // `linkElephants` will stop the program if you try and link an // elephant that doesn't exist! Uncomment and see what happens. // const missingElephant: ?*Elephant = null; - // linkElephants(&elephantC, missingElephant); + // linkElephants(missingElephant, &elephantC); visitElephants(&elephantA);