陣列的大括號寫法有二種,如下:
int a[3][3][2]=
{
1001,1002,1003,1004,1005,1006,
2001,2002,2003,2004,2005,2006,
3001,3002,3003,3004,3005,3006
};
int b[3][3][2]=
{
{{1001,1002},{1003,1004},{1005,1006}},
{{2001,2002},{2003,2004},{2005,2006}},
{{3001,3002},{3003,3004},{3005,3006}}
};
不能只在中間例如{2001,2002}這裡加大括號,要加就是三列三行及二個都要加大括號,來方便閱讀。不然就都不要加,只有最外面兩個大括號。 |