Array: Difference between revisions

Content deleted Content added
mNo edit summary
Ce (talk | contribs)
Pascal allows any lower index
Line 1:
[[Category:Encyclopedia]]An '''array''' is a composite data type, in the [[Collections|collection]] category, that stores multiple values all of the same declared type, index accessed by a numeric [[array index]] which is computed at [[run time]]. By using a variable index, the array may be accessed for a not predetermined set of indices, during the run of the program. An array in which indices are not numeric is known as an [[associative array]].
 
The array has a lower bound, and an upper bound, beyond which it is illegal to access the array. The lower bound is in many [[:Category:Programming Languages|programming languages]] fixed to either 0 ([[C]] and relatives) or 1 (Old [[PascalFortran]] and relatives), or arbitrary ([[Pascal]] and relatives, modern Fortran) but the upper bound is always programmable. The size of the array is the distance from the lower bound to the upper bound and one extra. In all regular programming languages, the size of the array can be determined by the programmer at [[compile time]] or after. In many modern programming languages the size of the array may be computed and allocated at run time. In some programming languages, the lower bound may also be specified by the programmer.
 
All values between (and including) the lower and the upper bound of the array may legally be accessed during the program run.