“Почему индекс массива начинается с 0” Ответ

Почему индекс массива начинается с 0

Array address: 0x7ffe9472bad0
Array[0] = 0x7ffe9472bad0
Array[1] = 0x7ffe9472bad4
Array[2] = 0x7ffe9472bad8
...

The first element and the array itself points to the same memory location, 
so it is 0 elements away from the location of the array itself.

// https://albertkoz.com/why-does-array-start-with-index-0-65ffc07cbce8
shahul

Почему индекс массива начинается с 0

An array arr[i] is interpreted as *(arr+i). Here, arr denotes the address of the first array element or the 0 index element. So *(arr+i) means the element at i distance from the first element of the array. So array index starts from 0 as initially i is 0 which means the first element of the array.
Lively Lion

Ответы похожие на “Почему индекс массива начинается с 0”

Вопросы похожие на “Почему индекс массива начинается с 0”

Смотреть популярные ответы по языку

Смотреть другие языки программирования