0

Where's the mistake in code

#include<stdio.h> struct x{ int i; char ch; }y(); void main() { run(); } void run() { int c; struct x info; char symbol[9]={'1','2','3','4','5','6','7','8','9'}; display(symbol); info=y(symbol,c); symbol[info.i]=info.ch; display(symbol); } struct x y(char sym[9],int c){ char value[1]; struct x info; in: if(c%2==0){ printf("\nEnter your choice: X"); }else{printf("\nEnter your choice: O"); }scanf("%s",value); for(i=0;i<9;i++){ if (*value==sym[i]){ info.i=i; if (c%2==0) info.ch='X'; else info.ch='O'; break; }else{ info.i=-1; info.ch=""; } }if(info.i==-1){ printf("\nInput Invalid"); goto in; }return info; } void display(char sym[9]) {printf("\n\t\t\t Tic Tac Toe"); printf("\n 1st Player's Input: X"); printf("\n 2nd Player's Input: O"); printf("\n\t\t\t | | "); printf("\n\t\t\t %c | %c | %c ", sym[0],sym[1],sym[2]); printf("\n\t\t\t -----|------|-----"); printf("\n\t\t\t %c | %c | %c ", sym[3],sym[4],sym[5]); printf("\n\t\t\t ----

30th Jul 2018, 1:17 PM
ADITYA RAJ
ADITYA RAJ - avatar
1 ответ
0
dude put the code in the code playground and then post the link here so that it will be easy to navigate thru the code :)
30th Jul 2018, 2:05 PM
Suhail Pappu
Suhail Pappu - avatar