From 55ad7c32f2d534b1fbd438204d21738f958c51a5 Mon Sep 17 00:00:00 2001 From: Dave Gauer Date: Tue, 9 Feb 2021 18:36:57 -0500 Subject: Moved exercises to exercises because exercises --- 39_pointers.zig | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 39_pointers.zig (limited to '39_pointers.zig') diff --git a/39_pointers.zig b/39_pointers.zig deleted file mode 100644 index 25b56c6..0000000 --- a/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 current 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}); -} -- cgit v1.2.3-ZIG