+ 2

Why array indexing start from 0 ?

22nd Feb 2017, 8:57 PM
Sourav Hasan
Sourav Hasan - avatar
5 Respostas
+ 13
"Should array indices start at 0 and 1? My compromise of 0.5 was rejected without, I thought, second consideration." - Stan Kelly-Bootle
23rd Feb 2017, 3:03 PM
Ram chandra Giri
Ram chandra Giri - avatar
+ 7
It's an old tradition, but remember it derives from the BASE 10 number system where 0 will always be the first number to count from - in this modern day and for sometime now we tend to start counting from 1 ignoring poor old ZERO. Base-10: 0 1 2 3 4 5 6 7 8 9
22nd Feb 2017, 9:26 PM
Mark Foxx
Mark Foxx - avatar
+ 6
that is a rule
22nd Feb 2017, 9:03 PM
chris
chris - avatar
22nd Feb 2017, 9:51 PM
Mario L.
Mario L. - avatar
+ 1
because it does. simple and plain as that, just follow the standards that have already been made.
22nd Feb 2017, 9:01 PM
Ousmane Diaw