C语言求救!!!
#include<stdio.h>void main()
{
void inv(int *x,int n);
int i,a={3,7,9,11,0,6,7,5,4,2};
printf("The original array:\n");
for (i=0;i<10;i++)
printf("%d",a);
printf("\n");
inv(a,10);
printf("The array has been inverted:\n");
for(i=0;i<10;i++)
printf("%d",a);
printf("\n");
}
void inv (int *x,int n )//形参x为数组名//
{
int *p,temp,*i,*j,m=(n-1)/2;
i=x;j=x+n-1;p=x+m;
for(;i<=p;i++,j--)
{
temp=*x;*x=*j;*j=temp;
}
return ;
}
感恩无私的分享与奉献 :)
页:
[1]