mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
Introduce syntax for turning a many pointer to a slice
This commit is contained in:
parent
9b58f3e83c
commit
b6abbf948c
1 changed files with 1 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
// var foo: [4]u8 = [4]u8{ 1, 2, 3, 4 };
|
// var foo: [4]u8 = [4]u8{ 1, 2, 3, 4 };
|
||||||
// var foo_slice: []u8 = foo[0..];
|
// var foo_slice: []u8 = foo[0..];
|
||||||
// var foo_ptr: [*]u8 = &foo;
|
// var foo_ptr: [*]u8 = &foo;
|
||||||
|
// var foo_slice_from_ptr: []u8 = foo_ptr[0..4];
|
||||||
//
|
//
|
||||||
// The difference between foo_slice and foo_ptr is that the slice has
|
// The difference between foo_slice and foo_ptr is that the slice has
|
||||||
// a known length. The pointer doesn't. It is up to YOU to keep track
|
// a known length. The pointer doesn't. It is up to YOU to keep track
|
||||||
|
|
Loading…
Reference in a new issue