I'm using C and I'd like to print these matrices with the printMatrix function. It's fine when I print A and B. But, I don't know how matrix C is printed. can anyone help?
#include <stdio.h>
void printMatrix(const int A[][3],const int col);
void main()
{
int A[2][3] = { {1,2,3},{-1,5,-9} };
int B[2][3] = { {1,2,3},{1,0,4} };
int C[3][2] = { {-2,1},{1,0},{5,4} };
printf("A\n");
printMatrix(A,2,3);
printf("B\n"); printMatrix(B,2,3);
printf("\n");
printf("C\n"); printMatrix(C,3,2);
}
void printMatrix(const int A[][3], const int row,const int col)
{
int i, j;
for (i = 0; i < row; i++) {
for (j = 0; j < col; j++) {
printf("%d ", A[i][j]);
}
printf("\n");
}
}