C99でここで間違っていること:
struct chess {
struct coordinate {
char piece;
int alive;
} pos[3];
}table[3] =
{
{
{'Q', (int)1},{'Q', (int)1},{'Q', (int)1},
{'B', (int)1},{'B', (int)1},{'B', (int)1},
{'K', (int)1},{'K', (int)1},{'K', (int)1},
}
};
エラーが発生します:
error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token
次のような構造体内に構造体を持つように、データにアクセスできるようにしたいと考えています。
table[row].pos[column].piece
table[row].pos[column].alive
いくつかの組み合わせを試しましたが、このケースではうまくいかないようです。それが機能する前に、以前の構造体のハードコードされた初期化を行いましたが、今回のように構造体内の構造体ではありません。
助言がありますか?