新手,有一个问题问下,关于将数组中 n 个整数按相反顺序存放
void inv(int x[ ],int n){
int temp,i,j,m=(n-1)/2;
for (i=0;i<=m;i++)
{
j=n-1+i;,
temp=x[i]; x[i]=x[j];x[j]=temp;
}
teturn
}
main ( )
{
int i,a[10]={3,1,2,87,34,35,6,7,123,45,,23}
printf("the original array:\n")
for (i=0;i<10;i++)
printf("%d",a[i]);
printf("\n");
inv (a,10);
printf("the array has been inverted:\n");
for (i=0,i<10;i++)
printf("%d",a[i]);
printf("\n");
}
编译的时候说int 没有定义
是怎么回事,
该怎么定义才好