#include <stdio.h>
void printArray(int (*ptr)[3], int rows)
{
int i, j;
for (i = 0; i < rows; i++)
{
for (j = 0; j < 3; j++)
{
printf("%d ", ptr[i][j]);
}
printf("\n");
}
}
int main(void)
{
int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};
int(*ptr)[3] = arr;
printf("The 2D array elements are:\n");
printArray(ptr, 2);
return 0;
}