index | Sololearn: Learn to code for FREE!

+3

index

Why does index of lists start with 0?

1/4/2017 10:44:32 AM

Yuta Nagaoka

3 Answers

New Answer

+5

Because it was decided to be like this (it's easier this way).

+2

because number system start with 0

+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!