EmbLogic's Blog

why array starts with 0 index?

2 Responses to why array starts with 0 index?

  1. mandeeshc says:

    The index of array, which is of the form a[i], is converted by the compiler in the form [a+i]. So, the index of first element is zero because [a+0] will give ‘a’ & the first array element can be accessed. Due to this, we can also access the array elements as’i[a]‘ instead of ‘a[i]‘ , &
    this will not produce an error.
    More so, because the Binary Count used by Computers always starts from 0. Lets say we have a 3 bit value.
    It’ll be something of this sought,
    000 –> 0
    001 –> 1 and so on .. .

  2. shyam says:

    it is due to the ease of calculation that our compiler do in calculating the addtess is nth index….
    (start add.)+index*sizeof(int)…if it nis an integer array…
    for first-index=0;
    for 2nd index=1;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>