Javatpoint Logo

Why array index start with zero?

By: awasth*** On: Thu Aug 30 17:52:13 IST 2012     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
Please anyone give me a specific reason why array index is start with zero.Up0Down

 
In my opinion, 0 is the lowest positive value that is why it starts from 0.Image Created0Down

By: [email protected] On: Thu Aug 30 18:38:12 IST 2012 Question Reputation0 Answer Reputation20 Belt Series Points0 20User Image
Are You Satisfied :0Yes0No
 
Array is a chunk of continues memory allocation. The arithmetic that is used by compiler to move to the next array location is -BaseAddress + (Index No.)*sizeof(datatype). i.e. baseaddress =>1001 datatype => int so array[2]; give address 1001 + 2*2 = 1005 that is address of third block. now if we see to access the first location of the array we have to give Index =0 and for next location index =1 and so on...This is why array index start with zero. Source-GoogleImage Created0Down

By: [email protected] On: Thu Aug 30 22:56:34 IST 2012 Question Reputation0 Answer Reputation20 Belt Series Points0 20User Image
Are You Satisfied :0Yes1No