Code:
a=a+b;
b=a-b;
a=a-b;
yes when dealing with numbers but can't be used for non-numbers such as strings. Also if the number is of a floating point type then rounding errors may happen which could mean that the new a and b values aren't exactly the same as the originals.

or
Code:
temp = a;
a = b;
b = temp;
This is the standard way of swapping two values. There's actually a template to this in the STL. See http://www.cplusplus.com/reference/algorithm/swap/