#include
#define N 5
void Reverse(int *, int);
int main()
{
int i, a[N];
printf("请输入%d组数字(空格隔开):n", N);
for(i=0; i
scanf("%d", &a[i]);
}
Reverse(a, N);
printf("n其倒序输出的数字为:n");
for(i=0; i
printf("n");
}
void Reverse(int *x, int n)
{
int t, *p, *i, *j, m = (n-1)/2;
i = x;
j = x + n - 1;
p = x + m;
for(;i<=p;i++,j--)
{
t = *i; *i = *j; *j = t;
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)