Array index always starts from 0

Programming languages are desinged in a such a way that the array name is always points to the first element of an array.

Example

If we declare arr[5] = {1, 2, 3, 4, 5}, then arr will point the first element of the array. i.e. arr holds the address of arr[0].

So, in order to access the first element, we should use index 0.

arr[0] which is equal to *(arr) ==> *(1024) ==> value stored at 1024 is 1.

Array index starts from zero

Array indexing will be calculated using the base address(first element's address).

arr+i = base address + i * sizeof(data type).

In our case, data type is int. base address is 1024.

So, arr+1 = 1024 + 1 * 4 => 1028

arr+2 = 1024 + 2 * 4 => 1032 and so on.

Array Indexing

If we use array index from 1, we will miss the first element always.

Because, arr+1 will point the second element in the array. arr[1] is as same as *(arr+1). *(1028) = 2.