title: Two dimension array and enum
body: <p>This is a evaluation function for Tic Tac Toe.  There is a error around the line 14 : 'else' without a previous 'if' but I could not find out what the error is.  What should I change the code??  </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  enum ttt {X, O, UNMARKED};
  enum ttt board[3][3];
  enum evalboard{XWon, OWon, NoOneWon, NotOverYet};
  
  void evaluation(void){
      int i;
  
      /*Check the rows*/
      for(i = 0; i &lt; 3; i = i + 1){
          if( (board[i][0] == X) &amp;&amp; (board[i][1] == X) &amp;&amp; (board[i][2] == X) )
              evalboard = XWon; break;
  
          else if(board[i][0] == O &amp;&amp; board[i][1] == O &amp;&amp; board[i][0] == O )
              evalboard = OWon; break;
  
          else if(board[i][0] == UNMARKED || board[i][1] == UNMARKED || board[i][2] == UNMARKED )
              evalboard = NotOverYet; break;
  
          else if(board[i][0] != UNMARKED || board[i][1] != UNMARKED || board[i][2] != UNMARKED )
              evalboard = NoOneWon; break;
      }
  
      /*Check the columns*/
      for(i = 0; i &lt; 3; i = i + 1){
          if( board[0][i] == X &amp;&amp; board[1][i] == X &amp;&amp; board[0][i] == X )
              evalboard XWon; break;
  
          else if( board[0][i] == O &amp;&amp; board[1][i] == O &amp;&amp; board[0][i] == O) )
              evalboard OWon; break;
  
          else if(board[0][i] == UNMARKED || board[1][i] == UNMARKED || board[2][i] == UNMARKED )
              evalboard = NotOverYet; break;
  
          else if(board[i][0] != UNMARKED || board[i][1] != UNMARKED || board[i][2] != UNMARKED )
              evalboard = NoOneWon; break;
      }
  
      /*Check the diagonals*/
  
      else if( board[0][0] == X &amp;&amp; board[1][1] == X &amp;&amp; board[0][0] == X )
          evalboard XWon;
  
      else if( board[0][2] == O &amp;&amp; board[1][1] == O &amp;&amp; board[0][2] == O )
          evalboard OWon;
  }
  </code></pre>