0

Why array indexing always starts with 0.

27th May 2017, 2:22 PM
Ajay Sirsat
Ajay Sirsat - avatar
5 Antworten
+ 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.
27th May 2017, 2:40 PM
Magne Tufte Bøyum
Magne Tufte Bøyum - avatar
+ 5
@Bjarte Same with R :)
27th May 2017, 6:00 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
27th May 2017, 2:49 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
indexing becomes easy. for example: array : e1,e2,e3,e4....... base =0 (e1) next elements can be obtained by base+1, base+2...
27th May 2017, 2:31 PM
Mohammad Fahad Sayed
Mohammad Fahad Sayed - avatar
27th May 2017, 2:55 PM
Bjarte Mehus Sunde
Bjarte Mehus Sunde - avatar