Hacker News new | ask | show | jobs
by goerz 1672 days ago
Right. Zero based indexing makes zero sense, unless you explain the underlying technical reason, that it’s an offset relative to a memory pointer (spend a week teaching pointers first!).

It makes sense in certain context (and in languages like C that have a low-level mental model). For scientific computing at a higher level of abstraction where the mental model of a multidimensional array is a tensor, and not a memory offset location, zero-based indices really get in the way

2 comments

> Zero based indexing makes zero sense

The sensibility of the index choice is equal to the starting value of the index.

StarWars indexing makes 4 sense.
yupyupyup, you got it. :)
Precisely. Indexing makes sense in a context, and it is trivial in general to switch. This said, telling people that the first element they want is the "0th", is completely unnatural.