[TUHS] Array index history
ron at ronnatalie.com
Wed Jun 7 23:16:33 AEST 2017
The original FORTRAN and BASIC arrays started indexing at one because everybody other than computer scientists start counting at 1.
These languages were for scientists and the beginner, so you wanted to make things compatible with their normal concepts.
PASCAL on the other hand required you to give the minimum and maximum index for the array.
It was an interesting concept when I got into computers in the early seventies that things would be numbered from zero. Tape drive 0, TTY0, etc…
Of course, C’s half-assaed implementation of arrays kind of depends on zero-indexing to work.
From: TUHS [mailto:tuhs-bounces at minnie.tuhs.org] On Behalf Of shawn wilson
Sent: Wednesday, June 7, 2017 8:57 AM
To: The Eunuchs Hysterical Society
Subject: [TUHS] Array index history
I learned the other day that array indexes in some languages start at 1 instead of 0. This seems to be an old trend that changed around the 70s? Who started this? Why was the change made?
It seems to have come about around the same time as C, but interestingly enough Lua is kinda in between (you can start an array at 0 or 1). Smalltalk can probably have a 0 base index just by it's nature, but I wonder whether that would work in a 40 year old interpreter.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the TUHS