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