why start from 1 not start from zero

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zhzy
    New Member
    • Jul 2013
    • 1

    why start from 1 not start from zero

    Code:
    char []c =null;
    c=new char[1];
    why star from [1] not from [0]???
    Last edited by Rabbit; Jul 16 '13, 03:40 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Because when you create an array, you are telling it how many elements you want. If you were to use 0, you care basically telling it you want an array with no elements. Which would be pointless, it would not hold any data.

    Comment

    Working...