gpt4 book ai didi

尝试编译 C 时出现编译错误

转载 作者:行者123 更新时间:2023-11-30 17:29:32 24 4
gpt4 key购买 nike

代码:

enum cell_contents checkMove[8][8];

错误:

warning: passing argument 2 of ‘test_for_winner’ from incompatible pointer type [enabled 
by default]
test_for_winner(&playerCurrent, &checkMove[8][8]);

note: expected ‘enum cell_contents (*)[8]’ but argument is of type ‘enum cell_contents *’
BOOLEAN test_for_winner(struct player * next_player,

我是 C 编程新手。我在这里做错了什么?

编辑 - 测试获胜者代码

BOOLEAN test_for_winner(struct player * next_player, enum cell_contents board[][BOARDWIDTH])
{
BOOLEAN has_moves = TRUE;
return has_moves;
}

最佳答案

我通过将函数调用更改为以下内容解决了问题:

test_for_winner(&playerCurrent, checkMove); 

关于尝试编译 C 时出现编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25588386/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com