3 ms·
it's a good idea to call the 0th element of an array the zeroth element, else you encourage off-by-one errors. The size of the array, the "count", is that which
by fsckboy 4y ago
it's a good idea to call the 0th element of an array the zeroth element, else you encourage off-by-one errors. The size of the array, the "count", is that which your index must be less than.
I'm not saying it has to be this way and it can't start with 1, I'm saying what you are pointing out as a flaw is actually the mixing of systems.
in computer programming teams it's best to adopt a standard unambiguous language to communicate to one another so as not have to constantly say "do you mean...?"
- iopq 4y agoNo, it's the first element, if it's a 32 bit int it still occupies bytes 0..4 the second int occupies bytes 4..8 you can see the array up to the second int occupies the contiguous space 0..8 which 0..4*2 and it has TWO elements