Btw it had no answer when i search so plz don't close it :)
Before we start this code is for Tic-Tac-Toe game
#include <stdio.h>
#define xo printf("\n\t %c │ %c │ %c\n\t───┼───┼───\n\t %c │ %c │ %c\n\t───┼───┼───\n\t %c │ %c │ %c\n",game[0],game[1],game[2],game[3],game[4],game[5],game[6],game[7],game[8]);
#define clr printf("\033[0;0H\033[2J");//only in linux
#define W getchar();getchar();//wait for 'enter'
#define P printf("\nChoose a number to play in it\n");scanf("%d",&play);
int place(char t[],int play,int k);
int main(void)
{
char game[10]="123456789";
int play;
do
{
clr xo P
if(!place(game, play, 1))
{
printf("\nWrong Input\nPress enter to continue\n");
W
}
printf("%d",place(game, play, 0));W
}while( place(game, play, 0)!=3 );
clr xo P
return 0;
}
int place(char t[],int play,int k)
{
int d;
switch (t[play-1])
{
case'X':
{
d=0;
break;
}
case 'O':
{
d=0;
break;
}
default:
{
if(k==0)
t[play-1]='X';
else
t[play-1]='O';
/*
if(!verification(t,k,play))
return 1;
else
return 3;*/
//printf("******\n");W
d=1;
break;
}
}
printf("%d----\n",d);
return d;
}
(sorry for my bad English and anyway thank u for only enter and try help)
That's my code the problem is in the function i don't know why but it just return 0 for no reason by the way
the zero that the function return the main just don't think it's a zero and don't think it's what i want to return i don't know why
my bug
if u want to try it with yourself:
my replit code