Why arrays start with zero | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Why arrays start with zero

Does anyone know the real reason behind this logic??.if you know tell your logic here,also don't Google otherwise you spoil it for everyone.In the end I will tell the real reason if by chance no one can tell

9th Jun 2018, 5:47 PM
Rahul Chauhan
Rahul Chauhan - avatar
4 Réponses
+ 2
Convention from old languages. Arrays used to be pretty much pointers with range, index marking the distance to look from start. Distance of start from start is 0.
9th Jun 2018, 6:10 PM
BlazingMagpie
BlazingMagpie - avatar
+ 1
BlazingMagpie All compiled languages hold arrays as pointers because that's how machine language works.
9th Jun 2018, 10:10 PM
Vlad Serbu
Vlad Serbu - avatar
- 1
Real programmers count from zero
9th Jun 2018, 6:16 PM
Anthony Perez