Merge pull request 'Reseted the simplification for de-referencing.' (#154) from i152 into main

Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/154
This commit is contained in:
Chris Boesch 2024-09-04 18:59:51 +00:00
commit c9a98ad555
2 changed files with 3 additions and 3 deletions

View file

@ -48,7 +48,7 @@ pub fn main() void {
// If e1 and e2 are valid pointers to elephants, // If e1 and e2 are valid pointers to elephants,
// this function links the elephants so that e1's tail "points" to e2. // this function links the elephants so that e1's tail "points" to e2.
fn linkElephants(e1: ?*Elephant, e2: ?*Elephant) void { fn linkElephants(e1: ?*Elephant, e2: ?*Elephant) void {
e1.?.tail = e2; e1.?.*.tail = e2.?;
} }
// This function visits all elephants once, starting with the // This function visits all elephants once, starting with the

View file

@ -1,5 +1,5 @@
--- exercises/046_optionals2.zig 2024-06-23 19:43:16 --- exercises/046_optionals2.zig 2024-09-04 20:51:36.766783971 +0200
+++ answers/046_optionals2.zig 2024-06-23 19:42:46 +++ answers/046_optionals2.zig 2024-09-04 20:51:01.389400985 +0200
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
const Elephant = struct { const Elephant = struct {