0
why index of array start from 0?
pls tell me frnds
2 Answers
+ 1
It comes from the C, where array[0] was equivalent to *(array+0) which is the same as *array, the first value of the array (if you want more explanations, learn about C or C++ pointers)
0
Not all languages array start from 0
For example in pascal you can choose what the indexes should be and where it starts from
In the array deceleration you can put:
array [0..20]
array [17..48]
array [-13..40]
and most impressively:
array [char] //array index is letters example "A"
If I remember rights you can also make an array with string as index