[E-6]
Write a function that prints the elements of a 2D integer array.
Write one row the the array per line on the screen.
Here is a framework:
#include <stdio.h>
#include <stdlib.h>
/* Puzzle DD03 -- print a 2D integer array */
void print2DArray ( int nrows, int ncols, int x[][] )
{
}
#define COLS 15
#define ROWS 5
int main()
{
int x[ROWS][COLS] ;
int count = 0;
int r, c; /* row and column indexes */
/* Fill the array with ascending integers */
for ( r=0; r<ROWS; r++ )
for ( c=0; c<COLS; c++ )
x[r][c] = count++ ;
/* Print the array using your function */
print2DArray( ROWS, COLS, x );
printf("\n");
return 0;
}