我做了一个家庭作业的程序,它在运行时没有任何错误崩溃.
在纠正之后,任何提高我的编码方法效率的建议都会受到赞赏.
首先,我将m,n,p,q声明为全局变量,我只将数组传递给函数,但程序表现得很奇怪.
然后我将数组的维度作为参数包含在每个函数中,并在任何地方声明它.CRASH
*VLA支持
//functions on matrices
#include<stdio.h>
int i, j;
void getMatrix(int m, int n, int values[m][n]);
void displayMatrix(int m, int n, int values[m][n]);
void transposeMatrix(int m, int n, int values[m][n]);
void addMatrices(int m, int n, int p, int q, int A[m][n], int B[p][q]);
void multiplyMatrices(int m, int n, int p, int q, int A[m][n], int B[p][q]);
int main()
{
int m, n, p, q, A[m][n], B[p][q];
printf("Enter the no. of Rows of the first Matrix : "); …Run Code Online (Sandbox Code Playgroud)