title: Comparing values: lvalue required as left operand of assignment
body: <p>Why can't I compare the results of the random function?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;time.h&gt;
  
  int main (){
  
  srand(time(NULL));
  
  /*Player 1*/
  int P1d1, P1d2, P1total;
  P1d1 = 1 + rand() % 6;  //Rolls Player 1's first die; random # between 1-6
  P1d2 = 1 + rand() % 6;  //Rolls Player 1's second die; random # between 1-6
  P1total = P1d1 + P1d2;  //Takes total of both rolls
  
  /*Player 2*/
  int P2d1, P2d2, P2total;
  P2d1 = 1 + rand() % 6; //Rolls Player 2's first die; random # between 1-6
  P2d2 = 1 + rand() % 6; //Rolls Player 2's second die; random # between 1-6
  P2total = P2d1 + P2d2; //Takes total of both rolls
  
  if (P1d1 == P1d2 &amp;&amp; P2d1 =! P2d2){ &lt;--- ERROR HERE
      printf("Player 1 wins!\n");
      }
  else if (P2d1 == P2d2 &amp;&amp; P1d1 =! P1d2) {
      printf("Player 2 wins!\n");
      }
  }
  </code></pre>
  
  <p>I get the error message <code>error: lvalue required as left operand of assignment</code>.</p>
  
  <p>I understand that this means the left-hand side of the assignment has to be a variable, but the left-hand side <em>is</em> a variable (int P1d1). Any suggestions?</p>