Why array indexing always starts from zero? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why array indexing always starts from zero?

This Question is asked in my Viva . I am totally confused there .

18th Jul 2016, 12:15 PM
Pankaj Joshi
Pankaj Joshi - avatar
5 Answers
+ 4
Good question! Well, that can be confusing for you right now, but computer is designed to count from zero becouse an old programming languages were working on binary (0-1) system and new languages accepted it and it just stay.
18th Jul 2016, 12:58 PM
Lule
+ 3
well may be lule is right, I am not sure but I think when we start counting zero (0) comes first then 1 and it is less then 1. so we start 0123-9. That's totally my point of view and please correct me if I am so.
18th Jul 2016, 10:03 PM
Amit Karn
Amit Karn - avatar
+ 2
Thank you !
18th Jul 2016, 1:35 PM
Pankaj Joshi
Pankaj Joshi - avatar
+ 2
It indipends for every language and you are right for some of them like all C languages but Pascal and the others works way I explained.
18th Jul 2016, 10:10 PM
Lule
+ 1
Because computers depends on math on every thing and counting numbers start from zero so it starts from zero in counting the index
19th Jul 2016, 8:48 AM
Mostafa Abobakr
Mostafa Abobakr - avatar