1 #include<stdio.h>
2
3 void inplace_swap(int *, int *);
4 void main(){
5 int a = 10;
6 int b = 20;
7
8 inplace_swap(&a, &b);
9 system("pause");
10 }
11
12 void inplace_swap(int *x, int *y){
13 *x = *x ^ *y;
14 printf("%d, %d\n", *x, *y);
15
16 *y = *x ^ *y;
17 printf("%d, %d\n", *x, *y);
18
19 *x = *x ^ *y;
20 printf("%d, %d\n", *x, *y);
21 }