0
Why array index is always started from 0 (zero) ?
3 odpowiedzi
+ 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
0
Java uses only whole numbers for the position of any element or characters. Hence,the position numbers start from 0
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.