0
這裏已經有一些這些線程,但它們中沒有一個真正回答我的問題。 在我的頭,我有:錯誤:數組類型具有不完整的元素類型
struct table_val
{
char res;
char carry;
};
typedef struct table_val TABLE_VAL;
,在我的源文件,我嘗試創建結構的這種靜態數組:
struct TABLE_VAL add_table[] = {
{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0},
{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}, {0, 1},
{2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}, {0, 1}, {1, 1},
{3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}, {0, 1}, {1, 1}, {2, 1},
{4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}, {0, 1}, {1, 1}, {2, 1}, {3, 1},
{5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}, {0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1},
{6, 0}, {7, 0}, {8, 0}, {9, 0}, {0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1},
{7, 0}, {8, 0}, {9, 0}, {0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1},
{8, 0}, {9, 0}, {0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1}, {7, 1},
{9, 0}, {0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {8, 1}
};
編譯這將導致在標題中錯誤。我不允許以這種方式創建一個數組嗎?如果沒有,是否有一個簡短的版本,比創建後初始化每個結構?
謝謝,這樣做! – wiseveri 2013-05-05 16:29:38