Print 2D Matrix
An array is a contiguous block of memory.In a 2D array there are many rows.The total number of elements in the array is row x column.We use 2 for loops to access elements of the array.
/*
http://www.ProbCOMP.com
An array is a contiguous block of memory.In a 2D array there are many rows.The total number of elements in the array is row x column
We use 2 for loops to access elements of the array.
*/
#include<stdio.h>
#define ROW 3
#define COL 2
void display(int arr[ROW][COL])
{
for(int i=0;i<ROW;i++)
{
for(int j=0;j<COL;j++)
{
printf("%d",arr[i][j]);
}
printf("\n");
}
}
void main()
{
int arr1[ROW][COL]={{1,2},{3,4},{5,6}};
display(arr3);
}
Download Program


