Learn something new every day
More Info... by email
An array object is a piece of data held in a specific place within a block of contiguous memory. These memory blocks are called arrays, and they are used to group similar objects together for easy organization and access within a computer program. The location of an object in an array is called an index; in most computer languages, the index of the first object starts at 0, rather than 1. An object does not need to be present at every index in an array. For example, an array could have space for five objects, but only have objects placed at indexes 0, 2, and 3.
All objects in an array must be of the same type, so if an array is declared to contain strings, every array object must be a string. An array object can be any size and contain any type of data, as long as the general object type is the one declared by the array. A string array could contain one string 50 characters long, and the next index could be 50,000 characters long; only their types matter. Array objects can be simple types, like a number or string, or any type of complex object.
In certain circumstances, an array object can be an entirely new array. When an array contains an object that is itself an array, the containing array is called a multidimensional array. There are two types of array objects in multidimensional arrays: the array objects that are themselves arrays, and the objects those secondary arrays hold. All the previous type rules apply to multidimensional arrays, so if one array object is also an array, all the other objects must be arrays as well. This nesting of arrays can be done as many times as needed, making two-dimensional grids, three-dimensional cubes, or higher-level clusters of data.
Arrays, and the type of array object allowed inside them, differ somewhat among programming languages. Some languages allow complete control over arrays and their objects, allowing a programmer to create them at will. Others hide the arrays and objects inside wrappers that allow a programmer to manipulate them indirectly. Still other languages have special constructs that force an array to see all objects as the same type, partially invalidating its rule on type specificity without breaking the underlying data. No matter how arrays are implemented, the array objects themselves are never affected except to be grouped, and the ability to group array objects is an important tool in data organization.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!