So. . .if I print a pointer for an array in #Zig, I can see the whole array. If I print an individual value, I see the address (And datatype, which is cool).
Do arrays work significantly differently in zig from C? Like, i the pointer to the array the same as the pointer to the value, but the compiler is injecting some magic into the format string?
@b4ux1t3 The types of these things are different enough to confuse when you’re first learning, but so much clearer to use after that point:
myNums is an array: a set of bytes (w/ comptime length)
&myNums or myNums[0..] is a slice, or a reference (w/ runtime length)
myNums[0] is the value at index 0
&myNums[0] is a pointer to the value at index 0
“a” here isn’t quite what I said though, your type specifically asks for the address of a 4-byte array so that’s what you got, not the slice []u8.
Once you get a pointer to a u8, like “b”, you can get the value using “b.*”.