If you have 2 variables a and b : (each variable takes its own memory address)
a = a xor b
b = a xor b
a = a xor b
There are also some other options for this problem, but they will fail if there is an overflow:
a = a + b
B = AB
a = ab
a = a * b
b = a / b
a = a / b
The plus and minus changes can work if you have custom types that have + and - operators that make sense.
. , 1 2 , . .
, , 2 . , , .
.. :
int a = 3;
int b = 3;
a = a ^ b;
b = a ^ b;
a = a ^ b;
assert(a == b);
assert(a == 3);