By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,655 Members | 1,860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,655 IT Pros & Developers. It's quick & easy.

why array index always starts with 0?

P: n/a
just i want to know the reason....
Oct 16 '10 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 9,197
Array indexes start with 0 because the name of the array is the address of the first element in the array.

So, the array name + 1 should be the second element.
That will only work if array name + 0 is the first element.

So then, array[0] is the first element and array[1] is the second element.
Oct 17 '10 #2

P: n/a
because array pointer has set by default as 0 position and if any data put in to the array that the pointer automatically point that element as 0 addressed and then next it will increase by 1.
for ex. ptr=0(first value)
Oct 18 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.