为什么我得到这种格式错误'%c'需要类型'int'

时间:2013-04-20 06:08:05

标签: c syntax typeerror

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

错误

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;
}

2 个答案:

答案 0 :(得分:1)

您不应在&player

中使用printf

更改

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

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

答案 1 :(得分:0)

尝试简单

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

没有&运营商的任何地址。