Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 3
    Simple answer is that when arrays are pointers, having base 0 is the most logical. Then myarray[0] and myarray+0 is the same element, and myarray[1] and myarray+1, etc. Think of it as an offset from the beginning. A more elaborate answer may be forthcoming so I'm just adding this as a comment :) Commented May 9, 2016 at 23:29
  • @ThomasH That's not quite "base 0." Base refers to how many unique symbols represent different values before adding a new position in the number. The base can be found by figuring out what 10-1 is in that system. Base 10 (decimal), base 2 (binary), and base 16 (hex) are the most widely known. Commented May 9, 2016 at 23:33
  • 1
    @WBT You would think that if you only read the title. Commented May 9, 2016 at 23:34
  • @user6292850 I agree it's a useful reference, but I don't think it's a dupe. Commented May 9, 2016 at 23:44
  • 3
    Dijkstra wrote this about zero indexes: cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html Commented May 19, 2016 at 20:02