mirror of
https://codeberg.org/ziglings/exercises.git
synced 2024-12-27 18:06:28 +00:00
Laying down some harsh string facts in ex54.
This commit is contained in:
parent
e8c5f411f2
commit
93eefe0f25
1 changed files with 5 additions and 3 deletions
|
@ -12,10 +12,12 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn main() void {
|
pub fn main() void {
|
||||||
// Take a good look at the type of the zen12 string:
|
// Take a good look at the array type to which we're coercing
|
||||||
|
// the zen12 string (the REAL nature of strings will be
|
||||||
|
// revealed when we've learned some additional features):
|
||||||
const zen12: *const [21]u8 = "Memory is a resource.";
|
const zen12: *const [21]u8 = "Memory is a resource.";
|
||||||
// It would also have been valid to coerce this 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 pointer":
|
||||||
|
|
Loading…
Reference in a new issue