Why is the first element in an array always 0? -
I am thinking that where the idea of the first element in an array came from zero. Why is not this 1? I have used for the fact that it is zero, but the first element can not be due to being zero.
An array is a block of sequential memory if the array starts with memory address x
, Then the first element is in the address x + 0
, the second is on the x + sizeof (arraytype)
, the third x + 2 * sizeof (Arraytype) is on
, etc.
Comments
Post a Comment