#include <stdio.h>
#include <string.h>
void reverse(char *s)
{
int i = 0;
int len = strlen(s);
int j = len-1;
while(i < j)
{
s[i] ^= s[j] ^= s[i] ^= s[j];
i++;
j--;
}
}
int main(void)
{
char str[] = "HelloWorld";
printf("%s\n",str);
reverse(str);
printf("%s\n",str);
return 0;
}
转载于:https://www.cnblogs.com/bluewelkin/p/3577969.html