Differentiate between 1d array and 2d array.
Answers
Answered by
2
Differences Between One-Dimensional and Two-Dimensional ArrayThe one-dimensional array is a list whose elements are of similar datatype. On the other hand, the two-dimensional array is a list whose elements are the array of similar data type.In C++, when the one-dimensional array is received by the parameter of a receiving function, it is not necessary to mention the size of the array as, compiler understands that the array of the type (mentioned datatype along with parameter) with some length is to be received. In a two-dimensional array, the second or right-most index is to be specified as compiler needs to know where a single row end’s and a new row starts.In C++, the one-dimensional array is stored in a contiguous memory location in the indexed order, whereas the two-dimensional array is also stored in the contiguous memory location, but as there are multiple rows in a two-dimensional array, storage of a first row is followed by a second and the third and so on.
Similar questions