Simple Example of Variable Switching Without a Temp Variable

  • Arithmetic Swaps Using Addition and Subtraction
  • Arithmetic Swaps Using Multiplication and Division
  • Bitwise Swaps Using XOR

Problems with Arithmetic

  • Multiplication and Division cannot be used where one variable is 0
  • Numbers too large for both Addition and Multiplication operations could go out of integer range