+ 3

index

Why does index of lists start with 0?

4th Jan 2017, 10:44 AM
Yuta Nagaoka
Yuta Nagaoka - avatar
3 odpowiedzi
+ 5
Because it was decided to be like this (it's easier this way).
4th Jan 2017, 10:50 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
because number system start with 0
4th Jan 2017, 12:03 PM
Lavish Thomas
Lavish Thomas - avatar
+ 1
I think It depends on how the list is stored in the Memory of your computer. A binary Number is used to address the list in Memory. To scan trough the list elements a binary Number is used too. by convention a binary Number of all zeroes is refered to the Number 0 I know that some programming languages adopt a different convention and start counting the lists or arrays at 1 there is and interesting article on why we should start counting at 0 written by prof.dr. Edsger W. Dijkstra https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html maybe this helps!
27th Feb 2017, 5:38 AM
steve