Array with only one dimension
Array of two dimensions
Array in three dimensions
Multi-dimensional arrays include two-dimensional and three-dimensional arrays. Multi-dimensional arrays include arrays of four or more dimensions, among other forms of arrays.
The elements of a one-dimensional array are stored in contiguous memory regions and are accessed using a single index value. It's a sequential data structure that stores all of the components in order.
The elements are kept in memory in order, and the array variable is essentially a pointer to the address of the array's first element. This is referred to as the base address. The following formula can be used to calculate the address of any other element.
BASEADDRESS – The address of the array's first element. A snapshot of the memory in this example shows how an array of size 8 is stored in memory. Put the numbers in the preceding formula to determine the memory address of a certain element, say the 6th element of the array.
K=6
WORDLENGTH=2 (integer information)
LOWERBOUND =1 LOWERBOUND =1 LOWERBOUND =1 (index of first element of the array)
1001 BASEADDRESS
A two-dimensional array is a tabular representation of data with elements stored in rows and columns, and it is one of the most common array forms. A two-dimensional array is made up of M X N elements arranged in M rows and N columns. Two subscripts are necessary to access any element in a two-dimensional array. These subscripts define the position of an element in a certain row and column. The first index is for the row number, while the second index is for the column index. The first index values row=2 column=3 are utilised to retrieve element 56 in the example.
A three-dimensional array is a depth-added expansion of a two-dimensional array. It resembles a cube with rows, columns, and a third dimension of depth. To get to any element in a three-dimensional array, you'll need three subscripts for the element's row, column, and depth. The depth (dimension or layer) index is the first, the row index is the second, and the column index is the third. The index values (2,0,3) are utilised to reach element 24 in the example.
|