Everything2
Near Matches
Ignore Exact
Full Text
Everything2

How to exchange two variables by using a third

created by scs

(idea) by scs (11.6 mon) (print)   ?   (I like it!) Tue May 24 2005 at 17:51:59

The best way to exchange two variables by using a third is simply to use a third, temporary variable, like this:

	tmp = a;
	a = b;
	b = tmp;
In some circles it's fashionable to try to exchange two variables without using a third, but this is an essentially pointless masochistic exercise, akin to, I don't know, writing a novel without using the letter E.

printable version
chaos

How to exchange two variables without using a third Gadsby XOR swap Crying when you go to the bathroom
Wink wink, nudge nudge The four levels of visibility in Java Rebecca A Void
XOR
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Things you could have written:
Tecumseh's Curse
Transformers Tech Specs
The revolution will not be webcast
E2 Quest: Copyright Redemption
Sei Shonagon
Japan
John Gotti
Bait al-Hikmah
Money laundering
Reading the Holy Bible
Why I did what I did
Destruction of Syntax - Imagination without Strings - Words-in-Freedom
Eight Drunken Immortals
New Writeups
fallensparks
George's Marvellous Medicine(thing)
Ctrl Y
cognitive dissonance(fiction)
SharQ
Gone Baby Gone(review)
halfWit
If I could, I'd title this "Freedom"(thing)
Roninspoon
Airline Hero(thing)
Ktistec
Why Women Are Always Cold(person)
doctor wilson
Drug policy reform(thing)
tejasa
Easy Raspberry Cheesecake(recipe)
Joysim
Drug policy reform(idea)
aneurin
Tyburn(place)
niruena
Boiling to death(idea)
artman2003
summer(thing)
doctor wilson
The Silver City and the Silent Sea(log)
Dreamvirus
The Silver City and the Silent Sea(poetry)
Aerobe
A nihilist's soulmate(poetry)
This page courtesy of The Everything Development Company