06 #include <stdio.h>
07 #include <string.h>
08
09 void revert(char *str)
10 {
11 int front, rear;
12
13 rear = strlen(str) - 1;
14 for(front = 0; front < rear; front++, rear--)
15 {
16 str[front] = str[front] ^ str[rear];
17 str[rear] = str[front] ^ str[rear];
18 str[front] = str[front] ^ str[rear];
19 }
20 }
21
22 int main(void)
23 {
24 char str[] = "hello, world!";
25 printf("%s\n", str);
26
27 revert(str);
28 printf("%s\n", str);
29
30 return(0);
31 }