0
How could we swap two number(in C language) without using third veriable as well as without using arithematic operators?
6 RĂ©ponses
+ 2
Not sure if this helps as it uses arithmetic operators, ...
a = a + b
b = a - b
a = a - b
+ 2
Thanksđ
+ 1
Im not sure that there is another way without doing some super elaborate thing
+ 1
A less known method using addition and subtraction, limited to integers too:
#define SWAP(a, b) ((a) -= (b), (b) += (a), (a) = (b) - (a))