如何用C语言编写一个求两个矩阵相乘的结果

如题所述

第1个回答  2017-04-15
/* Matrix_main.cpp */
//
#include
#include
#include
#include
/* #include */
void main(void)
{
int col, row, row_s; /* the column & row of the matrix */
int **pM_f = NULL, **pM_s = NULL; /* point to two matrix,they will be multiplied */
int **pM_r = NULL; /* the matrix will store the result */
int i, j, k;
printf("Input column & row of the first matrix:\n(depart with blank): ");
scanf("%d %d", &col, &row);
printf("Input row of the second one:\n(column needn't): ");
scanf("%d", &row_s);
/* ---------------Request storage for process--------------- */
pM_f = (int**)malloc(col * sizeof(int*));
pM_s = (int**)malloc(row * sizeof(int*));
pM_r = (int**)malloc(col * sizeof(int*));
for (i=0; i本回答被网友采纳
第2个回答  2017-04-15
用二维数组,遍历相乘
相似回答