2 ms·
The zero-based approach makes sense in C, where it is syntactic sugar and `a[i]` is equal to `*(a + i)` Treating it as offset of 0 is logical. The more you go
by johannes1234321 1y ago
The zero-based approach makes sense in C, where it is syntactic sugar and `a[i]` is equal to `*(a + i)` Treating it as offset of 0 is logical.
The more you go away from raw pointer semantics the less intuitive it gets.
- michaelrpeskin 1y agoFor extra fun, in C you can write i[a] since addition is commutative *(i+a) == *(a+i)