What do we mean by “dimension” when talking about arrays?
I understand the idea. But what would be the answer?
For example, int array[5]; I know that, this is a 1D array. It has 1 subscript in the index. But why is it called a 1 Dimensional array? Why not 1 Subscript array?
“Dimension of an Array” is the number of indices, or subscripts, that you need in order to specify an individual element of the array.
Dimensions and subscripts may be confusing. Subscript is a number (or another type of associative key), while dimension is a description of the range of acceptable keys; you need one subscript for each dimension of the array.
For example, in C/C++
a[10][5]is an array with two dimensions: of size 10 and of size 5. You need two subscripts, or keys, to address its elements. One subscript has to be between 0 and 9, inclusive; the other subscript is between 0 and 4.