C语言交换两个数的值

#include<stdio.h>
int main()
{
//交换两个数的值
// 方法一 可读性最好
int a = ;
int b = ;
int temp ;
temp = a;
a = b;
b = temp;
printf("a = %d, b = %d\n",a, b); //方法二
int c = ;
int d = ;
c = d - c;
d = d - c;
c = d + c;
printf("c = %d, d = %d\n",c, d);
// 方法三
int e = ;
int f = ;
e = e ^ f;
f = e ^ f;
e = e ^ f;
printf("e = %d, f = %d\n",e, f);
return ;
}
a = , b =
c = , d =
e = , f =
上一篇:c语言实现交换两个数的值


下一篇:整合spring cloud云架构 - 根据token获取用户信息