-1

为什么我的函数会出现此错误或类型冲突?其中玩家只是我只想输出的角色,以显示下一个玩家

错误

tictac.c:94: warning: format ‘%c’ expects type ‘int’, but argument 2 has type ‘char *’
tictac.c:94: warning: format ‘%c’ expects type ‘int’, but argument 2 has type ‘char *’

代码

void move(char player)
{
        int place;
        printf("player %c, enter placement: \n", &player);
        scanf("%d", &place);

        if (place == 1)
                board[0][0] = player;
        else if (place == 2)
                board[0][1] = player;
        else if (place == 3)
                board[0][2] = player;

        else if (place == 4)
                board[1][0] = player;
        else if (place == 5)
                board[1][1] = player;
        else if (place == 6)
                board[1][2] = player;

        else if (place == 7)
                board[2][0] = player;
        else if (place == 8)
                board[2][1] = player;
        else if (place == 9)
                board[2][2] = player;
}
4

2 回答 2

1

你不应该&player使用printf

改变

printf("player %c, enter placement: \n", &player);

printf("player %c, enter placement: \n", player);
于 2013-04-20T06:09:49.453 回答
0

尝试简单

 printf("player %c, enter placement: \n", player);

没有任何地址&运算符。

于 2013-04-20T06:09:39.013 回答