0

Why array index is always started from 0 (zero) ?

6th Feb 2017, 11:51 AM
navit
navit - avatar
3 Réponses
+ 3
by default. it also makes more sense: numbers start from 0 not from 1. think it this way we use decimal system so there are 10 numbers #0123456789# computers use binary code so there are two numbers #01#. Any numerical system starts with 0 as you can see
6th Feb 2017, 12:36 PM
infinity
infinity - avatar
0
Java uses only whole numbers for the position of any element or characters. Hence,the position numbers start from 0
6th Feb 2017, 2:05 PM
Bhaskar M R
Bhaskar M R - avatar
0
Accessing to elements of arrays that start from 0 is a bit faster than arrays that start from 1. In arrays that start from 0, program calculates addresses of elements with one less operation of subtraction.
6th Feb 2017, 4:33 PM
Bojan Suvajac
Bojan Suvajac - avatar