C++ 用宏实现swap(a,b)

#include <iostream>
using namespace std;
#define SWAP(a,b) a^=b,b^=a,a^=b

int main(void){
	int x = 2,y=3;
	SWAP(x,y);
	cout << x << ',' << y << endl;
	return 0;
}
posted @ 2016-12-15 11:28  niie9  阅读(542)  评论(0编辑  收藏  举报