C语言:二维数组列数未知作为函数形参进行传递如何解决?
#include<stdio.h>
#include<stdlib.h>
void Insert(int* Array[],int line,int list){
for (int i = 0; i <= line; i++)
{
for (int j = 0; j <= list; j++)
{
printf("请输入Array[%d][%d]的值:\n",i,j);
scanf("%d",&Array[i][j]);
//printf("值为%d\n",Array[i][j]);
}
}
}
int main(){
int line,list;
printf("请输入行数(包含常数项):");
scanf("%d",&line);
printf("请输入列数:");
scanf("%d",&list);
int Array[line][list];
Insert(Array,line,list);
for (int i = 1; i <= line; i++)
{
int num = Array[i][0] / Array[0][0];
for (int j = 0; j <= list; j++)
{
Array[i][j] -= Array[0][j] * num;
printf("值为%d\n",Array[i][j]);
}
}
}