这是一个练习变长数组的代码先上代码
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define LEN 3
#define WID 5
void show(int n,int m,double ar[n][m]);
double * Copy(int n,int m,double ar[n][m],double br[n][m]);
int main(void)
{
double d_Arry[LEN][WID];
double (* d_Pointer_1)[WID];
double d_Arry_1[LEN][WID];
srand(time(0));
for(int i = 0; i < LEN; i++)
{
for(int j = 0; j < WID; j++)
{
d_Arry[i][j] = (rand() % 10) * 0.1;
}
}
show(LEN,WID,d_Arry);
putchar('\n');
d_Pointer_1 = Copy(LEN,WID,d_Arry,d_Arry_1);//第28行
show(LEN,WID,d_Pointer_1);
putchar('\n');
return 0;
}
void show(int i_Len,int i_Width,double d_Arry[i_Len][i_Width])
{
for(int i = 0; i < i_Len; i++)
{
for(int j = 0; j < i_Width; j++)
{
printf("%3.1f ",d_Arry[i][j]);
}
putchar('\n');
}
}
double * Copy(int i_Len,int i_Width,double d_Arry[i_Len][i_Width],double d_Arry_1[i_Len][i_Width])
{
for(int i = 0; i < i_Len; i++)
{
for(int j = 0; j < i_Width; j++)
{
d_Arry_1[i][j] = d_Arry[i][j];
}
}
return d_Arry_1;//第62行
}
我只是搞不懂为啥28行和62行指针类型会不匹配,求大神指点