2D 配列の 2 つの要素を交換する関数を作成しようとしています。
void swap(int surface[][], int x1, int y1, int x2, int y2) {
int temp = surface[x1][y1];
surface[x1][y1] = surface[x2][y2];
surface[x2][y2] = temp;
}
ただし、コンパイル(gcc)しようとすると、次のエラーメッセージが表示されます。
Sim_Annealing.c: In function `swap':
Sim_Annealing.c:7: error: invalid use of array with unspecified bounds
Sim_Annealing.c:8: error: invalid use of array with unspecified bounds
Sim_Annealing.c:8: error: invalid use of array with unspecified bounds
Sim_Annealing.c:9: error: invalid use of array with unspecified bounds
2D 配列を関数パラメーターとして使用するために必要な特別な魔法はありますか?
ご協力いただきありがとうございます。関数パラメーターとしての配列の適切な参照を知っている場合は、それらを私の方法で送信してください:)