Always remain updated about current software development trends

Articles by GREGELLIS

Swap Two Numbers without using Temp Variable

You can do it with some XORs:int a = 25, b = 7;a = a ^ b;b = b ^ a;a = a ^ b;Or the same thing with some shorthand to make the code even harder to read:a ^= b;b ^= a;a ^= b;

  • Page 1 of 1
  •