该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
# define x 3
# define y 5
void copy(int f,int k,double ar[f][k],double ar1[][y]);
void xianshi(int s,int h,double ar2[s][h],double ar3[][y]);
int main(void)
{
int m=10,n=7;
double vsn[x][y]={{2.3,2.6,5.3,1.0,5.1},
{5.4,8.1,9.6,7.4,5.5},{1.9,9.3,9.9,5.8,4.7}};
double klk[m][n];//VLA数组不能被初始化
copy(m,n,klk,vsn);
xianshi(m,n,klk,vsn);
getchar();
return 0;
}
void copy(int f,int k,double ar[f][k],double ar1[][y])
{
int r,c;
for( r=0;r
for(c=0;c
if(r<3&&c<5)
ar[r][c]=ar1[r][c];
else
ar[r][c]=0.0;
return;
}
void xianshi(int s,int h,double ar2[s][h],double ar3[][y])
{
int t,q;
for( t=0;t
for( q=0;q
printf("klk[%d][%d] is %.2f\n",t,q,ar2[t][q]);
putchar('\n');
for( t=0;t
for( q=0;q
printf("vsn[%d][%d] is %.2f\n",t,q,ar3[t][q]);
return;
}
这个程序就是.c完全没问题.cpp就无法编译