News for hackers. Stuff that matters.
Re:Why do arrays start at 0? by TOGoS on Wednesday August 24, 2022 @05:08PM (#32585783)
As a kid, I saw these things often on multiple-choice test sheets. The tens digit at the end of each row not matching that at the beginning always seemed awkward, and I wondered why they didn't just start at zero. This was long before I did any programming.

The first year CE being "1" resulting in the new millennium starting at 2001 instead of 2000 also seemed idiotic, and the 1900s being referred to as "the 20th century" was something I always had to consciously compensate for. Numbering items starting at zero would have given us more elegant/less confusing ways to communicate those things.

Zero-based indexing makes things inherently simpler because it matches the way we write numbers (and becomes much more noticeable once you have more than one digit). It's not just an optimization for computers.

Re:Why do arrays start at 0? by adolph on Wednesday August 24, 2022 @05:43PM (#32586167)
Well, given that year numbering system's start in Europe, zero wasn't as broadly accepted as other digits at the time.

By AD 150, Ptolemy, influenced by Hipparchus and the Babylonians, was using a symbol for zero.

https://en.wikipedia.org/wiki/0#History

To keep it confusing: the traditional proleptic Gregorian calendar (like the Julian calendar) does not have a year 0 and instead uses the ordinal numbers 1, 2, ... both for years AD and BC. Thus the traditional time line is 2 BC, 1 BC, AD 1, and AD 2. ISO 8601 uses astronomical year numbering which includes a year 0 and negative numbers before it. Thus the ISO 8601 time line is −0001, 0000, 0001, and 0002.

https://en.wikipedia.org/wiki/Gregorian_calendar#Dual_dating