DD's Gibberish
A blog dedicated to coding
Pages
Tech Blog
Astronomy Blog
Personal Blog
Saturday, August 6, 2016
Swapping without using extra variable
function swap (a, b){ // 5,7
a = b - a; // 7-5 = 2
b = b - a; // 7-2 = 5
a = a + b; // 2 + 5 = 7
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment