How to Read, Store & Print 2D Arrays in C

Notes:

How to Read, Store & Print 2D Arrays in C Programming Language:

#include <stdio.h>

int main()
{
int numbers[2][2] = {
{0,0},
{0,0}
};

int row=0;
int col=0;

printf("Numbers array is:\n");

for(row=0; row<2; row++)
{
for(col=0; col<2; col++)
{
printf("%d ", numbers[row][col]);
}
printf("\n");
}

printf("Enter 4 integer values:\n");

for(row=0; row<2; row++)
{
for(col=0; col<2; col++)
{
scanf("%d",&numbers[row][col]);
}
}

printf("Numbers array is:\n");

for(row=0; row<2; row++)
{
for(col=0; col<2; col++)
{
printf("%d ", numbers[row][col]);
}
printf("\n");
}

return 0;
}