1.采用临时变量temp #include int main() { int x=10,y=20,temp; temp=x; x=y; y=temp; printf("%d,%d\n",x,y); return 0; } 2.和差法: #include int main() { int x=10,y=20; x=x+y; y=x-y; x=x-y; printf("%d,%d\n",x,y); return 0; } 3.异或法: #include int main() { int x=10,y=20; x=x^y; y=x^y; x=x^y; printf("%d,%d\n",x,y); return 0; }