复制一个二维数组 复制成功了 就是后面一堆乱码 感觉没有跳出循环的样子 求帮忙
#include <stdio.h>#define MARS 12
#define PLUTO 5
void copy(double [][MARS],double [][MARS],int);
int main(void)
{
double suns[PLUTO][MARS] =
{
{4.3,4.3,4.3,3.0,2.0,1.2,0.2,0.2,0.4,2.4,3.5,6.6},
{8.5,8.2,1.2,1.6,2.4,0.0,5.2,0.9,0.3,0.9,1.4,7.3},
{9.1,8.5,6.7,4.3,2.1,0.8,0.2,0.2,1.1,2.3,6.1,8.4},
{7.2,9.9,8.4,3.3,1.2,0.8,0.4,0.0,0.6,1.7,4.3,6.2},
{7.6,5.6,3.8,2.8,3.8,0.2,0.0,0.0,0.0,1.3,2.6,5.2},
};
double Jupiter[PLUTO][MARS];
printf("the suns is \n");
copy(suns,Jupiter,PLUTO);
return 0;
}
void copy(double a[][MARS],double b[][MARS] ,int c)
{
int p=0;
int m=0;
for(p=0;0<c;p++)
{
for(m=0;m<MARS;m++)
{
b[p][m]=a[p][m];
printf("%.1lf ",b[p][m]);
}
printf("\n");
}
}