title: why does if(++x=++y) works and if(x++=++y) does not work?
body: <p>when i am executing this program:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  int main(){
      int x=5,y=9;
  
      if(++x=y++){
          cout&lt;&lt;"Works "&lt;&lt;x;
      }
      else{
          cout&lt;&lt;"No";
      }
      return 0;
  }
  </code></pre>
  
  <p>it works fine and the output is: Works 9</p>
  
  <p>but if i execute:</p>
  
  <pre><code>  #include&lt;iostream&gt;
  using namespace std;
  int main(){
      int x=5,y=9;
  
      if(x++=y++){
          cout&lt;&lt;"Works "&lt;&lt;x;
      }
      else{
          cout&lt;&lt;"No";
      }
      return 0;
  }
  </code></pre>
  
  <p>it states:
   In function 'int main()':
  6:11: error: lvalue required as left operand of assignment
       if(x++=y++){</p>