Array
Why array index is starts with zero[0]?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jul 19, 2014, 11:56 AM
Similarly it began with zero in C++ because it began with zero in C and the former was intended to be (more or less) a superset of the latter.
I don't think Brian Kernighan and Dennis Ritchie actually say in their definitive book on the C language why indexing begins at zero but it's probably because arrays and pointers are closely related in that language and there's no doubt that zero indexing makes pointer arithmetic easier - the first element has a zero offset from the start of the array itself - and thus is easier to implement.
Whilst C# doesn't normally use explicit pointers, when you do use them in 'unsafe' code the advantage of zero based indexing soon becomes apparent.
Sanjay SinghPosted Jul 19, 2014, 10:19 AM
please visit this link
http://developeronline.blogspot.in/2008/04/why-array-index-should-start-from-0.html