display | more...

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.

Log in or register to write something here or to contact authors.