-3
#include<iostream.h>

main()
{
int a[10];
return 0;
}

why does array index always start with zero and not with one . Need valid reason !

STF
  • 1,485
  • 3
  • 19
  • 36
  • 3
    Because -7 looked silly. Other than that search a little, it's easy to google and there are many identical questions on Stack Overflow. – Denys Séguret Mar 20 '16 at 11:01
  • Why did you write here the code? You need some help with that? – STF Mar 20 '16 at 11:04
  • 4
    Possible duplicate of [Why does the indexing start with zero in 'C'?](http://stackoverflow.com/questions/7320686/why-does-the-indexing-start-with-zero-in-c) – Denys Séguret Mar 20 '16 at 11:05
  • In some languages, array indices start with 1. See [this question](http://stackoverflow.com/q/1499749/3345375). – jkdev Mar 20 '16 at 11:55
  • And remember that [different tasks call for different conventions](https://xkcd.com/163/). – jkdev Mar 20 '16 at 11:58

1 Answers1

1

Actually, there is a valid reason. It's because, an array is actually a pointer. So, A[0] means +0 from the beginning (the first position). That's why we use the 0 index.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
DimChtz
  • 4,043
  • 2
  • 21
  • 39