0
why index of arrays start from 0
3 Réponses
+ 1
It makes compilation easier.
Quoting from here
http://stackoverflow.com/questions/7320686/why-does-the-indexing-start-with-zero-in-c
0
Because.
- 1
It makes looping them easier. You can simply use:
for(int i =0; i < arr.length; i++)
If it started from 1 you would had to use this
for(int i=1; i < arr.length+1; i++)