I am trying to make a game of tic tac toe. I have declared this global array of character type.
#include<stdio.h>
static char game[3][3]={{' ',' ',' '},{' ',' ',' '},{' ',' ',' '}};
Then I am trying to change the values of the array elements according to the entries of the game.
void input()
{
char row[1],column[1];
char move;
printf("\nEnter Position (Row×Column) and Your Move (X or O):
\n");
scanf(" %c %c %c",&row[0],&column[0],&move);
temp++;
replace(row,column,move);
}
void replace(char r[1],char c[1],char m)
{
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(game[i]==r && game[j]==c)
{
game[i][j]=m;
break;
}
}
}
}
I changed the row and column variable to arrays because I was being shown the warning that 'iso c++ forbids comparison between pointer and integer fpermissive'. But I am still unable to see a change in the desired array element in the output. What am I doing wrong?