my ziglings
0

Configure Feed

Select the types of activity you want to include in your feed.

Introduce syntax for turning a many pointer to a slice

Uy Ha (Oct 18, 2023, 7:28 PM UTC) b6abbf94 9b58f3e8

+1
+1
exercises/054_manypointers.zig
··· 4 4 // var foo: [4]u8 = [4]u8{ 1, 2, 3, 4 }; 5 5 // var foo_slice: []u8 = foo[0..]; 6 6 // var foo_ptr: [*]u8 = &foo; 7 + // var foo_slice_from_ptr: []u8 = foo_ptr[0..4]; 7 8 // 8 9 // The difference between foo_slice and foo_ptr is that the slice has 9 10 // a known length. The pointer doesn't. It is up to YOU to keep track