Matrix multiplication has the premise that the number of columns in the first matrix is equal to the number of rows in the second matrix.
The product of a (aXb) matrix and a (bXc) matrix is an (aXc) matrix.
#include<stdio.h>
int main(void)
{
int a[3][2] = { 1,3,5,2,4,6}, b[2][4] = { 9,8,7,3,2,1,5,6}, c[3][2];
int i, j, k;
for (i = 0; i < 3; i++)
{
for (j = 0; j < 4; j++)
{
for (k = 0; k < 2; k++)
{
c[i][j] = a[i][k] * b[k][j];//k相等
}
printf("%3d", c[i][j]);
}
printf("\n");
}
return 0;
}