title: Why is a = (a+b) - (b=a) a bad choice for swapping two integers?
body: <p>I stumbled into this code for swapping two integers without using a temporary variable or the use of bitwise operators.</p>
  
  <pre><code>int main(){
  
      int a=2,b=3;
      printf("a=%d,b=%d",a,b);
      a=(a+b)-(b=a);
      printf("\na=%d,b=%d",a,b);
      return 0;
  }
  </code></pre>
  
  <p>But I think this code has undefined behavior in the swap statement <code>a = (a+b) - (b=a);</code> as it does not contain any <strong>sequence points</strong> to determine the order of evaluation. </p>
  
  <p>My question is: <em>Is this an acceptable solution to swap two integers?</em></p>