we usually use the
a=a+b;
b=a-b;
a=a-b;
logic to solve this code, however, if we work with int
, then after say 30000
the code fails, if we take long
, it fails after say 1000000
or so. My objective is, not to increase the length of the code yet, do the same operation. I have already tried using a BIT wise XOR
,
a = a ^ b;
b = a ^ b;
a = a ^ b;
Still it didn't help, any ideas?