31-10-2012, 05:55 PM
ARRAYS, POINTERS AND STRUCTURES – PARTICIPANT GUIDE
ARRAYS.doc (Size: 420 KB / Downloads: 51)
Introduction to arrays
An array is simply a sequence of items all of the same type and packaged together under one identifier name. An array, also known as a vector or list, is one of the simplest data structures. Arrays hold equally-sized data elements, generally of the same data type. Individual elements are accessed by index using a consecutive range of integers, as opposed to an associative array. Some arrays are multi-dimensional, meaning they are indexed by a fixed number of integers, for example by a tuple of four integers. Generally, one- and two-dimensional arrays are the most common.
Multi-dimensional Arrays: Advantages
• Useful when replicating matrix-like data storage
• They make data access easier for any data that can be represented in a matrix format
• Useful when we want to store entire sentences as a character string
• We can declare char
Key Points
• An array is a sequence of either objects or primitives, all of the same type and packaged together under one identifier name
• To refer to a particular element, specify the array name and position number: array [1]
• The first element in an array is at position zero: array [0]