What is two dimensional array?

Long Answer
Views 529

Answer:

Two-dimensional arrays, the most common multidimensional arrays, are used to store information that we normally represent in table form. Two-dimensional arrays, like one-dimensional arrays, are homogeneous. This means that all of the data in a two-dimensional array is of the same type. The two-dimensional array may also be visualized as a one-dimensional array of arrays.
Examples of applications involving two-dimensional arrays include:
1. a seating plan for a room (organized by rows and columns),
2. a monthly budget (organized by category and month), and
3. a grade book where rows might correspond to individual students and columns to student scores.
Declaration of Two-Dimensional Arrays
int a[3][2];
We can declare and initialize an array A as follows:
//declaration
int A[3][4] = {{8, 2, 6, 5}, //row 0
{6, 3, 1 ,0}, //row 1
{8, 7, 9, 6}}; //row 2

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Data Structure, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.