我在下一個循環中使用了數組的i值,所以我做錯了什麼?另一個錯誤說 TicTac.c:27:15:錯誤:數組類型'int [3]'不可賦值 Matrix [i,z] = h,v; 非常感謝,如果我以錯誤的方式提出我的問題,非常抱歉。這是我在這裏的第一個問題。非常感謝 !error:expression result unused [-Werror,-Wunused-value] Matrix [i,z] = h,v;我不明白?
{ /*The tic tac board*/
int Matrix[3][3] = { {6,6,6},
{6,6,6},
{6,6,6} };
/*asks user for input and gives value into the array*/
的for(int Z = 0; Z < = 2; ++ Z) {
for (int i = 0; i <= 2; ++i)
{
printf("Give me your choice in the horizontal layer");
int h = GetInt();
printf("Give me your choice in the verticle layer");
int v = GetInt();
Matrix[i,z] = h,v;
/*demonstrates the board*/
for(int o = 0; o <= 2; o++)
{
for(int j = 0; j <= 2; j++)
{
printf("%d ", Matrix[o][j]);
printf("\n");
}
}
}
}
'h,v'不符合您的想法。不知道這是你唯一的問題,但沒有足夠的代碼來說明。 http://stackoverflow.com/questions/54142/how-does-the-comma-operator-work –
比較什麼不工作'矩陣[我,z]'什麼'矩陣[o] [j]' 。你錯過了一些括號。 –
謝謝!現在它工作了! – shesdima