#include
void reverse(const int *start,const int *end)
{
int *tstart = start;
while (start != end)
{
int *left = tstart;
while (left != end)
{
if (*left > *(left + 1))
{
*left = *left^*(left + 1);
*(left + 1) = *left^*(left + 1);
*left = *left ^ *(left + 1);
left++;
}
else
left++;
}
start++;
}
}
int main()
{
int a[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
int len = sizeof(a) / sizeof(a[0]);
reverse(a, a + len - 1);
system("pause");
return 0;
}
原文:http://lzd1995.blog.51cto.com/10973198/1735480