方法一: int a,b; a=a+b; b=a-b; a=a-b; 方法二: 利用异或运算符交换两个变量的值,避免溢出 int i,j; i = i ^ j; i = i ^ j; i = i ^ j;