This commit is contained in:
Adam Millerchip 2021-12-27 00:09:07 +09:00
parent 69940c6103
commit d76bac99e2
1 changed files with 2 additions and 0 deletions

View File

@ -19,12 +19,14 @@ const Elephant = struct {
pub fn main() void {
var elephantA = Elephant{ .letter = 'A' };
// (Please add Elephant B here!)
var elephantB = Elephant{ .letter = 'B' };
var elephantC = Elephant{ .letter = 'C' };
// Link the elephants so that each tail "points" to the next elephant.
// They make a circle: A->B->C->A...
elephantA.tail = &elephantB;
// (Please link Elephant B's tail to Elephant C here!)
elephantB.tail = &elephantC;
elephantC.tail = &elephantA;
visitElephants(&elephantA);