In line no 20,27,32,36 even though the value is true the count value is not increasing at the end it is showing 0 count value. i think i have made an mistake while comparing array. i dont know how to compare an char element 2d array
the input is
1
xxx
ooo
the answer must be 3 the code is as below
#include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
for (int i = 0; i < n; n++)
{
int count = 0;
char t[2][2];
for (int i = 1; i <= 3; i++)
{
scanf("%c %c %c", &t[i][0], &t[i][1], &t[i][2]);
}
if (t[0][0] == '_' || t[0][1] == '_' || t[0][2] == '_' || t[1][0] == '_' || t[1][1] == '_' || t[1][2] == '_' || t[2][0] == '_' || t[2][1] == '_' || t[2][2] == '_')
{
for (int j = 0; j < 3; j++)
{
if (t[j][0] == t[j][1] == t[j][2])
{
20) count++;
}
}
for (int q = 0; q < 3; q++)
{
if (t[0][q] == t[1][q] == t[2][q])
{
27) count++;
}
}
if (t[0][0] == t[1][1] == t[2][2])
{
32) count++;
}
else if (t[0][2] == t[1][1] == t[2][0])
{
36) count++;
}
if (count == 0)
{
printf("%d", 2);
}
else if (count == 1)
{
printf("%d", 1);
}
else if (count > 1)
{
printf("%d", 3);
}
}
}
}