2940阅读 0评论2008-09-17 vaqeteart 分类:IT职场
交换两个数,不用第三块儿内存:
int a = ……;
int b = ……;
a = a + b;
b = a - b;
a = a - b;
或者:
a = a ^ b;
b = a ^ b;