+ 1

Why indexing of arrays always start from zero??

4th Aug 2017, 6:16 PM
Rishav Srivastava
Rishav Srivastava - avatar
2 Answers
+ 1
In C, the index is the 'distance' away from the starting element in the array. The first element is that location, so, it starts at 0. Probably some nice mathematical reasons too, but that's a reason with definition. Java bases most syntax from C, so stuck with it.
4th Aug 2017, 8:01 PM
Rrestoring faith
Rrestoring faith - avatar
it is easier to increment and decrement u will see its benefit after using loops several time.
5th Aug 2017, 12:45 AM
shobhit - avatar