Q:

2 dimensional character array

#include <stdio.h>
#include <stdlib.h>
#define rsize 3
#define csize 3

int
main()
{
    char tictac[rsize][csize];
    int a, b;

    printf("WELCOME TO TIC TAC TOE \n");

    for(a = 0; a < rsize; a++)
    {
        for(b = 0; b < csize; b++)
        {
            printf("Enter X or O: ");
            scanf(" %c", &tictac[a][b]);
        }
    }
    for(a = 0; a < rsize; a++)
    {
        if (tictac[a][0] == tictac[a][1] && tictac[a][1] == tictac[a][2]);
        {
            printf("Row %d has all %c's \n", a, tictac[a][0]);
        }
        if (tictac[0][a] == tictac[1][a] && tictac[1][a] == tictac[2][a]);
        {
            printf("Column %d has all %c's \n", a, tictac[0][a]);
        }
    }

    system("pause");
    return(0);
}

It's supposed to be a 3x3 tictac toe game but it doesn't seem to be working.  The problem is the if statement I'm not sure why it doesn't work.  Come someone help me out and point out my problem?

A:

You have extra semicolons in the middle of the if statements that cause them to be empty.  So your code is effectively
if (...) {
   /* do nothing */
}
{
    printf(...
}

and the printfs are always executed.  Get rid of the ';' between the ')' and the '{'

