how can you swap two variables without a temporary variable?

simple! the almost-magical XOR operator!

in C/C++, you can do this:

a^=b^=a^=b;

(addendum, 2001-08-22) ... Well, actually you can not, in fact, do that. Or you can, it's just not 100% guaranteed to work according to the ISO C standard. To use the xor swap correctly, you need something more like this:

a^=b; b^=a; a^=b;
Why? Well, in ISO C, a variable is not allowed to be modified more than once between sequence points. Since a is modified twice in the original expression, the expression is undefined, and thus might not work on all compilers.

(Thanks to scs for pointing me at Question 3.3b in the comp.lang.c FAQ, from which I gleaned this updated information.)