my ziglings
0

Configure Feed

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

Removed confusing explanation from 076

Dave Gauer (Oct 18, 2021, 7:04 PM EDT) 4c7eebbb ef4bd3c7

+20 -6
+2 -4
exercises/076_sentinels.zig
··· 59 59 // demonstrate how they are similar and different. 60 60 // 61 61 // (It turns out that the array prints completely, including 62 - // the sentinel 0 in the middle. The many-item pointer must 63 - // stop at the first sentinel value. The difference is simply 64 - // that arrays have a known length and many-item pointers 65 - // don't.) 62 + // the sentinel 0 in the middle. The many-item pointer stops 63 + // at the first sentinel value.) 66 64 printSequence(nums); 67 65 printSequence(ptr); 68 66
+18 -2
patches/patches/076_sentinels.patch
··· 1 - 86c86 1 + 38,40d37 2 + < // Important: the sentinel value must be of the same type as the 3 + < // data being terminated! 4 + < // 5 + 56c53 6 + < // numbers that both ends in and CONTAINS the sentinel value. 7 + --- 8 + > // numbers that both ends in and CONTAINS the sentinal value. 9 + 62,63c59,62 10 + < // the sentinel 0 in the middle. The many-item pointer stops 11 + < // at the first sentinel value.) 12 + --- 13 + > // the sentinel 0 in the middle. The many-item pointer must 14 + > // stop at the first sentinel value. The difference is simply 15 + > // that arrays have a known length and many-item pointers 16 + > // don't.) 17 + 84c83 2 18 < for (???) |s| { 3 19 --- 4 20 > for (my_seq) |s| { 5 - 98c98 21 + 96c95 6 22 < while (??? != my_sentinel) { 7 23 --- 8 24 > while (my_seq[i] != my_sentinel) {