当前位置:网站首页>Two numbers replace each other

Two numbers replace each other

2022-07-05 00:13:00 sunyin. liu

#include <stdio.h>
void swap(int a, int b);
int main(){
	int a = 5;
	int b = 6;
	// printf("a=%d,b=%d\n",a,b);
	printf("a=%d,b=%d\n",a,b);
	swap(a,b);
	
	return 0;
}
void swap(int a,int b){
	a = a ^ b;
	b = a ^ b;
	a = a ^ b;
	printf("a=%d,b=%d\n",a,b);
}

 

原网站

版权声明
本文为[sunyin. liu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050012179044.html