strcmp関数の正しい使い方を教えてもらえますか?三目並べゲームを作成していますが、エラーが発生し続けます。
passing argument 1 of ‘strcmp’ makes pointer from integer without a cast
関数のパラメーターとして機能する2つのポインターを作成しましたstrcmp。1つはプレーヤーが入力する入力で、もう1つはプレーヤーが持つ動きの選択です。ただし、コードを実行しようとすると、上記のエラーが発生します。以下は私のコードの一部です:
void mark_location(int userU, char str) {
char *moves[] = {"upperLeft", "up", "upperRight", "left", "center", "right", "lowerLeft", "down", "lowerRight"};
if (strcmp(str, moves[0]) == 0)
board[0][0] = userU;
else if (strcmp(str, moves[1]) == 0)
board[0][1] = userU;
else if (strcmp(str, moves[2]) == 0)
board[0][2] = userU;
else if (strcmp(str, moves[3]) == 0)
board[1][0] = userU;
else if (strcmp(str, moves[4]) == 0)
board[1][1] = userU;
else if (strcmp(str, moves[5]) == 0)
board[1][2] = userU;
else if (strcmp(str, moves[6]) == 0)
board[2][0] = userU;
else if (strcmp(str, moves[7]) == 0)
board[2][1] = userU;
else if (strcmp(str, moves[8]) == 0)
board [2][2] = userU;
}