#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<windows.h>
void swap(int * x, int *y)
{
*y = *x^*y;
*x = *x^*y;
*y = *x^*y;
}
void reverse_array(int a[], int cnt)
{
for (size_t i = 0; i < cnt-i-1; i++)
{
swap(&a[i], &a[cnt - i - 1]);
}
}
void main()
{
int a[] = { 4, 2, 1, 5, 6,7 };
reverse_array(a, 6);
for (int i = 0; i < 6;i++)
{
printf("%d,", a[i]);
}
//只是为了不让命令行关闭
char b;
scanf("%c", &b);
}