Category: 

What Is an Array Object?

Article Details
  • Written By: Jessica Susan Reuter
  • Edited By: Shereen Skola
  • Last Modified Date: 03 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
In late 19th-century London, mail was delivered to residential addresses up to twelve times each day.   more...

September 28 ,  1924 :  Two US military planes complete the first flights around the world.  more...

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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}