diff options
author | Dave Gauer <dave@ratfactor.com> | 2021-03-12 18:59:46 -0500 |
---|---|---|
committer | Dave Gauer <dave@ratfactor.com> | 2021-03-12 18:59:46 -0500 |
commit | 6ad9774189fbd64b2f2c9519f4513ab34b0c3809 (patch) | |
tree | d6c90700131d5b28e898881f13e2a05612e4703f /exercises/39_pointers.zig | |
parent | be36352572ddb18218e1830e49316c259dea5e8c (diff) | |
download | ziglings-6ad9774189fbd64b2f2c9519f4513ab34b0c3809.tar.gz ziglings-6ad9774189fbd64b2f2c9519f4513ab34b0c3809.tar.bz2 ziglings-6ad9774189fbd64b2f2c9519f4513ab34b0c3809.tar.xz ziglings-6ad9774189fbd64b2f2c9519f4513ab34b0c3809.zip |
"999 is enough for anybody" triple-zero padding (#18)
When I hit 999 exercises, I will finally have reached the ultimate
state of soteriological release and no more exercises will be needed.
The cycle will be complete. All that will be left is perfect quietude,
freedom, and highest happiness.
Diffstat (limited to 'exercises/39_pointers.zig')
-rw-r--r-- | exercises/39_pointers.zig | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/exercises/39_pointers.zig b/exercises/39_pointers.zig deleted file mode 100644 index d545525..0000000 --- a/exercises/39_pointers.zig +++ /dev/null @@ -1,36 +0,0 @@ -// -// Check this out: -// -// var foo: u8 = 5; // foo is 5 -// var bar: *u8 = &foo; // bar is a pointer -// -// What is a pointer? It's a reference to a value. In this example -// bar is a reference to the memory space that currently contains the -// value 5. -// -// A cheatsheet given the above declarations: -// -// u8 the type of a u8 value -// foo the value 5 -// *u8 the type of a pointer to a u8 value -// &foo a reference to foo -// bar a pointer to the value at foo -// bar.* the value 5 (the dereferenced value "at" bar) -// -// We'll see why pointers are useful in a moment. For now, see if you -// can make this example work! -// -const std = @import("std"); - -pub fn main() void { - var num1: u8 = 5; - var num1_pointer: *u8 = &num1; - - var num2: u8 = undefined; - - // Please make num2 equal 5 using num1_pointer! - // (See the "cheatsheet" above for ideas.) - num2 = ???; - - std.debug.print("num1: {}, num2: {}\n", .{ num1, num2 }); -} |