代码为:
#include <stdio.h>
#include<cstring>
int main( )
{
int a[3][3];
int i,j;
void c(int b[3][3]);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf(“%d”,&a[i][j]);
}
c(a);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf(“%d”,a[i][j]);
printf(“\n”);
}
return 0;
}
void c(int b [3][3])
{
int i,j;
int m[3][3];
memcpy(m,b,9) //把b中数组值复制给m数组
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
b[i][j]=m[i][j];
}
}
使用复制是为了改变b数组中的值,能在主函数中输出。但是确无法输出结果。这是为什么呢?这个程序到底哪里错了?望解答