Why array indexing start from zero? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why array indexing start from zero?

1st Dec 2016, 7:29 AM
Akshay Shinde
Akshay Shinde - avatar
2 Answers
+ 2
The index is used as an offset. The first element of the array is exactly contained in the memory location that array refers (0 elements away), so it should be denoted as array[0]. Most programming languages have been designed this way, so indexing from 0 is pretty much inherent to the language.
1st Dec 2016, 8:04 AM
Akwin Lopez
Akwin Lopez - avatar
+ 1
computer at its basic level starts counting by 0. so it is kept in language too some new language make it by 1 too but some not as people normally expect it there
1st Dec 2016, 9:23 AM
Sandeep Chatterjee