#include <stdio.h>
void print(int matrix[][4], int rows, int cols)
{
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
printf("%3d", matrix[i][j]);
}
printf("\n");
}
}
int main(int argc, char** argv)
{
int matrix[][4] = { { 1, 1, 1, 1 }, { 2, 2, 2, 2 }, { 3, 3, 3, 3 } };
int rows = sizeof matrix / sizeof(matrix[0]);
int cols = sizeof matrix[0] / sizeof(matrix[0][0]);
print(matrix, rows, cols);
return 0;
}
/*
run:
1 1 1 1
2 2 2 2
3 3 3 3
*/