C Programming Code Examples C > Arrays and Matrices Code Examples C Programming Code - Simple Two dimensional(2D) Array C Programming Code - Simple Two dimensional(2D) Array An array of arrays is known as 2D array. The two dimensional (2D) array in C programming is also known as matrix. A matrix can be represented as a table of rows and columns. Before we discuss more about two Dimensional array lets have a look at the following C program. This program demonstrates how to store the elements entered by user in a 2d array and how to display the elements of a two dimensional array. #include<stdio.h> int main(){ /* 2D array declaration*/ int disp[2][3]; /*Counter variables for the loop*/ int x, j; for(x=0; x<2; x++) { for(j=0;j<3;j++) { printf("Enter value for disp[%d][%d]:", x, j); scanf("%d", &disp[x][j]); } } //Displaying array elements printf("Two Dimensional array elements:\n"); for(x=0; x<2; x++) { for(j=0;j<3;j++) { printf("%d ", disp[x][j]); if(j==2){ printf("\n"); } } } return 0; }