Learn exple.tive.org

Why do programmers start counting at zero?  ↦

Mike Hoye dives deep to answer this question:

By now your peripheral vision should have convinced you that this is a long article…

He’s right. This piece looked so long that I kept it open in a tab (the original Instapaper) for a couple of weeks before reading it. But it’s not so bad! And the topic is fascinating:

starting at 1 is not an unreasonable position at all; to a typical human thinking about the zeroth element of an array doesn’t make any more sense than trying to catch the zeroth bus that comes by, but we’ve clearly ended up here somehow. So what’s the story there?

My head canon on the topic treats zero-indexing in terms of offsets. How much of an offset do you need to reach the first entry in the array? Zero. How much for the second? One. Turns out, nope that’s not why!


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00