在我的代码中,我只是尝试使用函数 Print_Matrix(M) 打印初始化矩阵,但是当该函数出现分段错误时,但是当我在主函数中打印它时,它会按预期打印
这是我复制问题的代码
#include<stdio.h>
#include<stdlib.h>
int N = 5;
typedef struct matrix{
double m[1024][1024];
int size;
}matrix;
matrix I;
void
Print_Matrix(matrix M)
{
printf("hello\n");
int row=0, col=0;
for (row = 0; row < N; row++) {
for (col = 0; col < N; col++){
printf(" %5.2f", M.m[row][col]);
}
printf("\n");
}
printf("\n\n");
}
int main()
{
int row, col;
for (row = 0; row < N; row++) {
for (col = 0; col < N; col++) {
if (row == …Run Code Online (Sandbox Code Playgroud)