0
Why array indexing always starts with 0.
5 Réponses
+ 5
In order to conserve memory it is best to use as few bits as possible and the index with only binary zeroes is always present and therefore used. With two bits you can have 4 indexes instead of just 3 if you start counting 1. Indexing will use binary values 00, 01, 10 & 11.
+ 5
@Bjarte Same with R :)
+ 1
Here is an interesting article about this issue:
http://developeronline.blogspot.com/2008/04/why-array-index-should-start-from-0.html
0
indexing becomes easy.
for example: array : e1,e2,e3,e4.......
base =0 (e1)
next elements can be obtained by base+1, base+2...
0
Fun fact: MATLAB indexing starts at 1.
https://se.mathworks.com/matlabcentral/newsreader/view_thread/316993