Without using an intermediate switching values of the two variable number

Method 1: Use the +

a += b;
b = a - b;
a -= b

Act II: the use of ^

a ^= b;
b ^= a;
a ^= b;

 

 

Reproduced in: https: //my.oschina.net/dake/blog/196834

Guess you like

Origin blog.csdn.net/weixin_34082789/article/details/91586092