Chris Baus

Why do programmers count from 0?

After years of C and C++ programming, I instinctually start counting from 0. But why?

The obvious answer that the first offset into an array is base address + 0, which is why C arrays start with the 0th element. Also, the first unsigned integer is 0. Making 0x00000000 anything other than 0 would be far worse than counting from 0.

0 based counting also makes sense in domains that deal with time such as video and audio editing. If you cue a track to the beginning that is t + 0. And a baby is 0 years old when it is born.

Ok that was just a random thought, but there you have it.