代码实现如下:
#include <stdio.h>
int main(int argc, const char *argv[])
{
int arr[5];
int i, j;
int *start = arr;
int *end = arr + 4;
int temp;
printf("请输入整形数组:");
for(i = 0; i < 5; i++)
{
scanf("%d", (start+i));
}
while(end > start)
{
temp = *start;
*start = *end;
*end = temp;
end --;
start ++;
}
printf("倒置后的数组是:");
for(i = 0; i < 5; i++)
printf("%-4d", arr[i]);
putchar('\n');
return 0;
}
运行结果如下: