About Lesson
Multidimensional arrays are arrays of arrays. They are useful for representing tabular data or matrices.
int matrix[3][3] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; // Declaration and initialization of a 3×3 matrix
Accessing elements of a multidimensional array involves specifying both row and column indices.
cout << matrix[1][2]; // Accessing the element in the second row and third column
Â
Join the conversation