0
Why index start with 0 but not with 1
3 Réponses
+ 5
computers work in binary code, and binary code starts from 0, so in programming there are lots of thing which start from 0
however Mario's answer is better ^-^
+ 3
very detailed answer:
http://stackoverflow.com/questions/7320686/why-does-the-indexing-start-with-zero-in-c
(the long one, not the first answer)
+ 2
It's a logical, mathematical reason: imagine you count floor in a building, and each item array is a stage... first element is on ground floor, level 0, second on frst floor, and so on.
Now, you want to convert the level into the height to where each item is stored ( the memory address ): you know that the height of each floor ( the space required by a type of data ) is H... considering our numeration starting at zero, we can tell: height of item at level N is equal to height H times by level N ^^