one-dimensional array

<types>

An array with only one dimension; the simplest kind of array, consisting of a sequence of items ("elements"), all of the same type. An element is selected by an integer index that normally starts at zero for the first element and increases by one. The index of the last element is thus the length of the array minus one.

A one-dimensional array is also known as a vector. It should not be confused with a list. In some languages, e.g. Perl, all arrays are one-dimensional and higher dimensions are represented as arrays of pointers to arrays (which can have different sizes and can themselves contain pointers to arrays and so on).

A one-dimensional array maps simply to memory: the address of an element with index i is

 A(i) = A0 + i * s

where A0 is the base address of the array and s is the size of storage used for each element, the "stride". Elements may be padded to certain address boundaries, e.g. machine words, to increase access speed, in which case the stride will be larger than the amount of data in an element.

Last updated: 2014-03-22

Nearby terms:

one-banana problemone-dimensional arrayone-line fixone-liner wars

Try this search on Wikipedia, Wiktionary, Google, OneLook.



Loading