C programming language is known as a zero index array language. The first item in an array is accessible using 0
. For example double arr[2] = {1.5,2.5}
The first item in array arr
is at position 0. arr[0] === 1.5
What programming languages are 1 based indexes?
I've heard of the these languages start at 1 instead of 0 for array access: Algol, Matlab, Action!, Pascal, Fortran, Cobol. Is this complete?
Specificially, a 1 based array would access the first item with 1, not zero.
In addition, some languages like C and C++ use pointers to store data, therefore it makes sense for indices to start at zero as well, because the memory address is held by the program counter at 0 first by default, thus making compilation easier.
Martin Richards, creator of the BCPL language (a precursor of C ), designed arrays initiating at 0 as the natural position to start accessing the array contents in the language, since the value of a pointer p used as an address accesses the position p+0 in memory.
Some languages only have linked lists (for example some functional and logical programming languages). Some languages don't have arrays or lists, but are expressive enough that linked lists can be easily defined.
A list can be found on wikipedia.
ALGOL 68 APL AWK CFML COBOL Fortran FoxPro Julia Lua Mathematica MATLAB PL/I Ring RPG Sass Smalltalk Wolfram Language XPath/XQuery
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With