3 ms·
It's not a C thing, it's a math/utility thing. Dijkstra: Why numbering should start at zero https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.
by jhvkjhk 5y ago
It's not a C thing, it's a math/utility thing.
Dijkstra: Why numbering should start at zero
https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...
- corysama 5y agoWhich is funny because Lua got it’s 1-base from FORTRAN which, I believe, adopted it to make TRANslating math FORmulas easier.
- tovej 5y agoI agree in part that it's a C thing. More accurately it's an offset from the array base thing. The first element is at index 0 because its address is base + 0 * sizeof(element) The second element is at index 1 because its address is base + 1 * sizeof(element)