title: How does one compare a char variable to another char variable?
body: <p>I'm working on a homework assignment in C where we need to make a tic-tac-toe game that can be played between two players.  I have all of my code working at this point, except for the function that checks to find a winner.  Here's an example of the outcome of a game I tested with:</p>
  
  <pre><code>  0 1 2
  0  |x| 
    -----
  1  |o| 
    -----
  2  |x| 
  Congratulations to player 1!  You won!
  </code></pre>
  
  <p>To which I say, no.  No, player 1 definitely didn't win.  My checks are (forgive me) a series of nested if statements like so:</p>
  
  <pre><code>...
  else if (gameboard[0][1] != ' ')
      if (gameboard[1][1] == gameboard[0][1])
          if(gameboard[2][1] == gameboard[1][1])
              return 1;
  ...
  </code></pre>
  
  <p>gameboard[0][1] is an <code>'x'</code> value, yet the comparison says that gameboard[1][1] is equal to it.  Why is this happening and how do I fix it?</p>