Correct conventional Zig reference vs value passing re #89

This commit is contained in:
Dave Gauer 2022-07-31 15:57:20 -04:00
parent 0e64778f3c
commit b8617bb752
7 changed files with 49 additions and 19 deletions

View file

@ -1,6 +1,15 @@
//
// Now let's use pointers to do something we haven't been
// able to do before: pass a value by reference to a function!
// able to do before: pass a value by reference to a function.
//
// Why would we wish to pass a pointer to an integer variable
// rather than the integer value itself? Because then we are
// allowed to *change* the value of the variable!
//
// +-----------------------------------------------+
// | Pass by reference when you want to change the |
// | pointed-to value. Otherwise, pass the value. |
// +-----------------------------------------------+
//
const std = @import("std");