fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. char g[3][3];
  5.  
  6. void reset() {
  7. for(int i = 0; i < 3; i++)
  8. for (int j = 0; j < 3; j++)
  9. g[i][j] = ' ';
  10. }
  11.  
  12. int display(void)
  13. {
  14. printf("%c|%c|%c",g[0][0],g[0][1],g[0][2]);
  15. printf("------------");
  16. printf("%c|%c|%c",g[1][0],g[1][1],g[1][2]);
  17. printf("------------");
  18. printf("%c|%c|%c",g[2][0],g[2][1],g[2][2]);
  19. }
  20.  
  21. int start()
  22. {
  23. printf("Enter coordinates for move");
  24. scanf(%d %d,&i &j);
  25. g[i+1][j+1]= X;
  26.  
  27. int main()
  28. {
  29. reset();
  30. display();
  31. printf("X starts the game");
  32. start();
  33. return 0;
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘start’:
prog.c:24:8: error: expected expression before ‘%’ token
  scanf(%d %d,&i &j);
        ^
prog.c:25:4: error: ‘i’ undeclared (first use in this function)
  g[i+1][j+1]= X;
    ^
prog.c:25:4: note: each undeclared identifier is reported only once for each function it appears in
prog.c:25:9: error: ‘j’ undeclared (first use in this function)
  g[i+1][j+1]= X;
         ^
prog.c:25:15: error: ‘X’ undeclared (first use in this function)
  g[i+1][j+1]= X;
               ^
prog.c:27:6: warning: ‘main’ is normally a non-static function [-Wmain]
  int main()
      ^~~~
prog.c:34:2: error: expected declaration or statement at end of input
  }
  ^
prog.c: In function ‘display’:
prog.c:19:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
prog.c: In function ‘start’:
prog.c:34:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
At top level:
prog.c:27:6: warning: ‘main’ defined but not used [-Wunused-function]
  int main()
      ^~~~
stdout
Standard output is empty