+ 2
Can any one answer why array index always starts with 0??
4 ответов
+ 11
In reference to SO,
The expression of an array with index of n refers to a memory location n-elements away from the starting element. 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].
for more info:
http://developeronline.blogspot.com/2008/04/why-array-index-should-start-from-0.html
+ 4
It is a convention created by the creator of languages.
It can be explained in Hatsy's reply, but this is a common understanding
+ 1
Pretty convinced with hatsy's reply.. Thanks a lot guys
+ 1
Because WKT arrays are ends with null character. If we declare a array kd[5]
in the sense, It value starts from kd[0] to kd[4] for five elements and the kd[5] is stored with a NULL character.