Many programming language use the syntax a[i]
to refer to the i
'th element of an array, sequence, or vector a
– specifically, C and Pascal (from the late 1960s and early 1970s) do this. On the other hand, some earlier languages, like that Fortran (from the 1950s), don't use this convention. Also, I studied a bit of math, and mathematicians use square brackets for intervals, and subscripts for, well, array and matrix subscripting (or regular parentheses if the array is thought of as a function from non-negative integers).
So, my question is: Where/how/in what context did this square brackets for array subscripting develop, and by whom?
Note: Not at all a dupe of this question about the use of curly brackets in C.
Best Answer
The main precursor language to C and Pascal was Algol. The earliest version of that was Algol 58 which used square brackets for array declarations and references.
The reason that Algol used square brackets rather than, for example, parentheses was three-fold:
Note, unlike C, which uses arrays mostly to index memory, Algol allowed both lower and upper index bounds to be specified. Again, this was in keeping with its more mathematical intent. So much so, in fact, that Algol was the de facto language for pseudocode for many years.