C语言中交换两个数的方法
方法一:利用中间变量
int a =10,b=20;
int tmp;
tmp = a;
a = b;
b = tmp;
方法二:利用迭代
int a = 10,b=20;
a = a+b;
b = a-b;
a = a-b;
C语言中交换两个数的方法
方法一:利用中间变量
int a =10,b=20;
int tmp;
tmp = a;
a = b;
b = tmp;
方法二:利用迭代
int a = 10,b=20;
a = a+b;
b = a-b;
a = a-b;