No”if”, No”?", No”switch”, No temp, How to exchange two variables?
Posted on 2011-02-21 15:44 alexkk2011 阅读(120) 评论(0) 收藏 举报1)
a=a+b;
b=a-b;
a=a-b;
: ( if a and b are too big for computer, that may cause overflow.
2)
a=a^b;
b=a^b;
a=a^b;
: )
|
|||
No”if”, No”?", No”switch”, No temp, How to exchange two variables?Posted on 2011-02-21 15:44 alexkk2011 阅读(120) 评论(0) 收藏 举报1) a=a+b; b=a-b; a=a-b; : ( if a and b are too big for computer, that may cause overflow. 2) a=a^b; b=a^b; a=a^b; : )
|
|||