Groups
Groups
Sign in
Groups
Groups
Code fellow's playground
Conversations
About
Send feedback
Help
[技巧]不使用額外變數做兩數交換
5 views
Skip to first unread message
cpyi
unread,
Apr 7, 2013, 8:02:50 AM
4/7/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to code_fellow...@googlegroups.com
兩數交換一般要用一個中繼變數tmp,最近看到一個寫法,可以不要用中繼變數。
a = a+b-(a=b);
這只是酷炫的技巧,別人看不懂,效率也不會提高,僅供參考。
Reply all
Reply to author
Forward
0 new messages