mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
Many pointers -> many-item pointers
This commit is contained in:
parent
c48e6f8087
commit
9cc49f98b9
2 changed files with 3 additions and 3 deletions
|
@ -131,7 +131,7 @@ Planned exercises:
|
||||||
* [x] Optionals
|
* [x] Optionals
|
||||||
* [x] Struct methods
|
* [x] Struct methods
|
||||||
* [x] Slices
|
* [x] Slices
|
||||||
* [x] Many pointers
|
* [x] Many-item pointers
|
||||||
* [x] Unions
|
* [x] Unions
|
||||||
* [ ] Numeric types (integers, floats)
|
* [ ] Numeric types (integers, floats)
|
||||||
* [ ] Labelled blocks and loops
|
* [ ] Labelled blocks and loops
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub fn main() void {
|
||||||
// It would also have been valid to coerce to a slice:
|
// It would also have been valid to coerce to a slice:
|
||||||
// const zen12: []const u8 = "...";
|
// const zen12: []const u8 = "...";
|
||||||
//
|
//
|
||||||
// Now let's turn this into a "many pointer":
|
// Now let's turn this into a "many-item pointer":
|
||||||
const zen_manyptr: [*]const u8 = zen12;
|
const zen_manyptr: [*]const u8 = zen12;
|
||||||
|
|
||||||
// It's okay to access zen_manyptr just like an array or slice as
|
// It's okay to access zen_manyptr just like an array or slice as
|
||||||
|
@ -28,7 +28,7 @@ pub fn main() void {
|
||||||
//
|
//
|
||||||
// A "string" in Zig is a pointer to an array of const u8 values
|
// A "string" in Zig is a pointer to an array of const u8 values
|
||||||
// or a slice of const u8 values, into one, as we saw above). So,
|
// or a slice of const u8 values, into one, as we saw above). So,
|
||||||
// we could treat a "many pointer" of const u8 a string as long
|
// we could treat a "many-item pointer" of const u8 a string as long
|
||||||
// as we can CONVERT IT TO A SLICE. (Hint: we do know the length!)
|
// as we can CONVERT IT TO A SLICE. (Hint: we do know the length!)
|
||||||
//
|
//
|
||||||
// Please fix this line so the print below statement can print it:
|
// Please fix this line so the print below statement can print it:
|
||||||
|
|
Loading…
Reference in a new issue