get_move() を作成して、xy 座標を持つマトリックス上でプレーヤー 1 またはプレーヤー 2 の動きをスキャンしようとしています。
get_move() には 2 つのパラメーターがあります。最初の 1 つは、2 人のプレイヤーのどちらが移動するか (プレイヤー 1 またはプレイヤー 2) です。2 番目のパラメータは移動であり、配列でなければなりません。
私が理解していないのは、メイン関数から移動をスキャンし、それをパラメーターとして get_move() に送信する方法です。つまり、移動をスキャンするのは get_move() ですが、get_move() のパラメーターの 1 つがスキャンされた xy 座標配列になるのでしょうか?!
#include <stdio.h>
void get_move(int player, char input[])
{
printf("Player %d, make your move: ");
scanf("%d %d", &input[][]);
}
int main(void)
{
int player = 1;
get_move(player, ???); // I can't scan the coordinates and insert them as the second parameter, because the function is supposed to make the scan???
getchar();
return 0;
}