AskDefine | Define array

Dictionary Definition



1 an orderly arrangement; "an array of troops in battle order"
2 an impressive display; "it was a bewildering array of books"; "his tools were in an orderly array on the basement wall"
3 especially fine or decorative clothing [syn: raiment, regalia]
4 an arrangement of aerials spaced to give desired directional characteristics


1 lay out in a line [syn: range, lay out, set out]
2 align oneself with a group or a way of thinking [syn: align]

User Contributed Dictionary




  1. To clothe and ornament oneself.
    He was arrayed in his finest robes and jewels.


to clothe/ornament


  1. Clothing and ornamentation.
  2. A collection laid out to be viewed in full.
  3. An orderly series, arrangement or sequence.
    Antonym Disarray.
  4. A large collection.
    We offer a dazzling array of choices.
  5. A vector.
  6. A multidimensional array.
  7. An associative array.

Usage notes

  • (the data structure) The synonym "vector" is more precise when the array is one-dimensional and the indices are either non-negative or positive integers.

See also


collection laid out
large collection
computing - arrangement of memory elements

Extensive Definition

In computer science an array is a data structure consisting of a group of elements that are accessed by indexing. In most programming languages each element has the same data type and the array occupies a contiguous area of storage. Most programming languages have a built-in array data type.
Some older languages referred to arrays as tables. This was the practice in COBOL.
Some programming languages support array programming (e.g., APL, newer versions of Fortran) which generalises operations and functions to work transparently over arrays as they do with scalars, instead of requiring looping over array members.
Multi-dimensional arrays are accessed using more than one index: one for each dimension.
Arrays can be classified as fixed-sized arrays (sometimes known as static arrays) whose size cannot change once their storage has been allocated, or dynamic arrays, which can be resized.


Variables normally only store a single value but, in some situations, it is useful to have a variable that can store a series of related values - using an array. For example, suppose a program is required that will calculate the average age among a group of six students. The ages of the students could be stored in six integer variables in C programming language:
int age1; int age2; int age3; ...
However, a better solution would be to declare a six-element array:
int age[6];
This creates a six element array; the elements can be accessed as age[0] through age[5] in C.
(Note: in Visual Basic .NET the similar declaration Dim age(6) as Integer will create a seven element array, accessed as age(0) through age(6).)

Implicit array

A new array object is implicitly created when an array initializer expression is evaluated; this can occur when a class or interface is initialized, when a new instance of a class is created, or when a local variable declaration statement is executed.


Because of their performance characteristics, arrays are used to implement other data structures, such as heaps, hash tables, deques, queues, stacks, strings, and VLists.
Some algorithms store a variable number of elements in part of a fixed-size array, which is equivalent to using dynamic array with a fixed capacity. See dynamic array for details.
Associative arrays provide a mechanism for array-like functionality without huge storage overheads when the index values are sparse. Specialized associative arrays with integer keys include Patricia tries and Judy arrays.


The valid index values of each dimension of an array are a bounded set of integers. Programming environments that check indexes for validity are said to perform bounds checking.

Index of the first element

The index of the first element (sometimes called the "origin") varies by language. There are three main implementations: zero-based, one-based, and n-based arrays, for which the first element has an index of zero, one, or a programmer-specified value. The zero-based array is more natural in the root machine language and was popularized by the C programming language, in which the abstraction of array is very weak, and an index n of a one-dimensional array is simply the offset of the element accessed from the address of the first (or "zeroth") element (scaled by the size of the element). One-based arrays are based on traditional mathematics notation for matrices and most, but not all, mathematical sequences. n-based is made available so the programmer is free to choose the lower bound, which may even be negative, which is most naturally suited for the problem at hand.
The Comparison of programming languages (array), indicates the base index used by various languages.
Supporters of zero-based indexing sometimes criticize one-based and n-based arrays for being slower. Often this criticism is mistaken when one-based or n-based array accesses are optimized with common subexpression elimination (for single dimensioned arrays) and/or with well-defined dope vectors (for multi-dimensioned arrays). However, in multidimensional arrays where the net offset into linear memory is computed from all of the indices, zero-based indexing is more natural, simpler, and faster. Edsger W. Dijkstra expressed an opinion in this debate: Why numbering should start at zero.
The 0-based/1-based debate is not limited to just programming languages. For example, the ground-floor of a building is elevator button "0" in France, but elevator button "1" in the USA.

Indexing Methods

When the Array is implemented as continuous storage, the index-based access, e.g. to element n, is simply done (for zero-based indexing) by using the address of the first element and adding n · sizeof(one element). So this is a Θ(1) operation.
But there are cases, where continuous storage might be a bad idea:
  • Insertion and deletion should also be a common operation, but continuous storage requires Θ(n) time for them. Here a balanced tree can be used, giving Θ(log n) for both index access and inserting/deleting. For example the TextBuffer of GTK+ is implemented on top of a B-Tree, which has lower overhead compared to a binary tree like the AVL Tree.
  • Allowing non-integer indices, which is also called an Associative array. PHP Arrays are indexed by integers, but can also be accessed by string keys.

Multi-dimensional arrays

Ordinary arrays are indexed by a single integer. Also useful, particularly in numerical and graphics applications, is the concept of a multi-dimensional array, in which we index into the array using an ordered list of integers, such as in a[3,1,5]. The number of integers in the list used to index into the multi-dimensional array is always the same and is referred to as the array's dimensionality, and the bounds on each of these are called the array's dimensions. An array with dimensionality k is often called k-dimensional. One-dimensional arrays correspond to the simple arrays discussed thus far; two-dimensional arrays are a particularly common representation for matrices. In practice, the dimensionality of an array rarely exceeds three. Mapping a one-dimensional array into memory is obvious, since memory is logically itself a (very large) one-dimensional array. When we reach higher-dimensional arrays, however, the problem is no longer obvious. Suppose we want to represent this simple two-dimensional array:
\mathbf =
\begin 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end.
It is most common to index this array using the RC-convention, where elements are referred in row, column fashion or A_\,, such as:
A_=1,\ A_=2,\ \ldots,\ A_=8,\ A_=9.\,
Common ways to index into multi-dimensional arrays include:
  • Row-major order. Used most notably by statically-declared arrays in C. The elements of each row are stored in order.
  • Column-major order. Used most notably in Fortran. The elements of each column are stored in order.
  • Arrays of arrays. Multi-dimensional arrays are typically represented by one-dimensional arrays of references (Iliffe vectors) to other one-dimensional arrays. The subarrays can be either the rows or columns.
The first two forms are more compact and have potentially better locality of reference, but are also more limiting; the arrays must be rectangular, meaning that no row can contain more elements than any other. Arrays of arrays, on the other hand, allow the creation of ragged arrays, also called jagged arrays, in which the valid range of one index depends on the value of another, or in this case, simply that different rows can be different sizes. Arrays of arrays are also of value in programming languages that only supply one-dimensional arrays as primitives.
In many applications, such as numerical applications working with matrices, we iterate over rectangular two-dimensional arrays in predictable ways. For example, computing an element of the matrix product AB involves iterating over a row of A and a column of B simultaneously. In mapping the individual array indexes into memory, we wish to exploit locality of reference as much as we can. A compiler can sometimes automatically choose the layout for an array so that sequentially accessed elements are stored sequentially in memory; in our example, it might choose row-major order for A, and column-major order for B. Even more exotic orderings can be used, for example if we iterate over the main diagonal of a matrix.


array in Bengali: অ্যারে
array in Catalan: Vector (programació)
array in Czech: Pole (datová struktura)
array in German: Array
array in Spanish: Vector (programación)
array in Esperanto: Aro (komputiko)
array in French: Tableau (structure de données)
array in Indonesian: Larik
array in Icelandic: Fylki (tölvunarfræði)
array in Italian: Array
array in Hebrew: מערך (מבנה נתונים)
array in Hungarian: Tömb
array in Dutch: Array
array in Japanese: 配列
array in Polish: Tablica
array in Portuguese: Array
array in Russian: Индексный массив
array in Simple English: Array
array in Slovak: Pole (údajová štruktúra)
array in Slovenian: Tabela (računalništvo)
array in Serbian: Низ (структура података)
array in Finnish: Taulukko (tietorakenne)
array in Swedish: Array
array in Turkish: Dizi (bilgisayar bilimleri)
array in Ukrainian: Масив (структура даних)
array in Chinese: 数组

Synonyms, Antonyms and Related Words

Indian file, adduce, adorn, advance, align, allege, allocate, allocation, allot, allotment, apparel, apportion, apportionment, armed force, armed service, army, arrange, arrangement, arranging, arraying, articulation, attire, bank, batch, beautify, bedeck, bedizen, bedizenment, bedrape, blazon, body, bring forward, bring on, bring to bear, bunch, bundle, bundle up, buzz, career soldiers, catena, catenation, chain, chain reaction, chaining, clad, clothe, clothes, clothing, clump, cluster, clutch, collation, collocate, collocation, color, compose, concatenation, concord, connection, consecution, constitution, continuum, cool off, costume, course, cycle, dandify, deal, deal out, deck, deck out, decorate, deploy, deployment, descent, dight, disposal, dispose, disposition, distribute, distribution, dizen, doll up, drape, drapery, dress, dress up, dressing, drone, dud, duds, embellish, emblazon, embroider, enclothe, endless belt, endless round, endue, enrich, enrobe, enshroud, envelop, enwrap, exhibition, exposing, fanfare, fashion, fatigues, feathers, fig, fig out, fighting machine, file, filiation, fix, fix up, forces, form, formation, formulation, furbish, gamut, garb, garment, garments, garnish, gear, grace, gradation, grade, ground forces, ground troops, guise, gussy up, habiliment, habilitate, habit, harmonize, harmony, hierarchize, host, hum, invest, investiture, investment, lap, lay out, layout, legions, line, line up, lineage, linen, lineup, lot, marshal, marshaling, methodize, military establishment, monotone, muffle up, nexus, normalize, occupation force, offer, order, ordering, organization, organize, ornament, pacify, paint, panoply, parade, paratroops, parcel out, peace, pendulum, periodicity, place, placement, plead, plenum, pomp, powder train, prank, prank up, preen, present, prettify, primp, primp up, prink, prink up, produce, progression, proportion, queue, quiet, quietude, rag out, rags, raiment, rally, range, rank, rank and file, ranks, recurrence, redecorate, redo, refurbish, regiment, regimentation, regular army, regularity, regularize, regulars, regulate, reticulation, robe, robes, rotation, round, routine, routinize, row, run, scale, sequence, series, set, set off, set out, set up, setup, sheathe, shine, show, showing, shroud, single file, ski troops, smarten, smarten up, soldiery, space, spectrum, sportswear, spruce up, standardize, standing army, storm troops, string, string out, structure, structuring, style, succession, swaddle, swath, swathe, symmetry, syntax, system, systematize, the line, the military, thread, threads, tier, tire, titivate, togs, toilette, train, tranquilize, tranquillity, trick out, trick up, trim, troops, uniformity, vestment, vesture, wear, wearing apparel, windrow, wrap, wrap up
Privacy Policy, About Us, Terms and Conditions, Contact Us
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2
Material from Wikipedia, Wiktionary, Dict
Valid HTML 4.01 Strict, Valid CSS Level 2.1