Question
Why does counting start from 0?
Answer
In short, just remember that almost all programming languages start counting from zero because it’s optimal.
A famous Dutch computer scientist, Edsger Dijkstra, gives a great mathematical explanation for this! It basically comes down to optimization, which is a common reason behind computer system design choices like this. Dijkstra says, “when starting with subscript 1, the subscript range 1 ≤ i < N+1; starting with 0, however, gives the nicer range 0 ≤ i < N,” in his paper called “Why numbering should start at zero.”