I'm writing a tic tac toe program and I have a problem with the function that determines whether or not there is a winner. When I try to compile, it gives me an error saying there are conflicting types of the function. All return values should be a character, so I can't figure out what the problem is.
Here is the function:
Code:
char checkWinner (char cell[])
{
if(cell[0] == cell[1] == cell[2])
{
if(cell[0] != ' ')
{
return cell[0];
} else return ' ';
} else if(cell[3] == cell[4] == cell[5])
{
if(cell[3] != ' ')
{
return cell[3];
} else return ' ';
} else if(cell[6] == cell[7] == cell[8])
{
if(cell[6] != ' ')
{
return cell[6];
} else return ' ';
} else if(cell[0] == cell[3] == cell[6])
{
if(cell[0] != ' ')
{
return cell[0];
} else return ' ';
} else if(cell[1] == cell[4] == cell[7])
{
if(cell[1] != ' ')
{
return cell[1];
} else return ' ';
} else if(cell[2] == cell[5] == cell[8])
{
if(cell[2] != ' ')
{
return cell[2];
} else return ' ';
} else if(cell[0] == cell[4] == cell[8])
{
if(cell[0] != ' ')
{
return cell[0];
} else return ' ';
} else if(cell[2] == cell[4] == cell[6])
{
if(cell[2] != ' ')
{
return cell[2];
} else return ' ';
} else return 'd';
}