# 初始化结构数组

Scentle5S

``````typedef struct Voie {
int num;
int sem_num[3];
int crois[3];
} Voie;
``````

``````Voie voies[12];
``````

``````{1,{0,16,1},{4,7,8}}
{2,{2,3},{4,5}}
{3,{},{}}
{4,{4,17,5},{7,10,11}}
{5,{6,7},{7,8}}
{6,{},{}}
{7,{8,17,9},{10,1,2}}
{8,{10,11},{10,11}}
{9,{},{}}
{10,{12,16,13},{1,4,5}}
{11,{14,15},{1,2}}
{12,{},{}}
``````

``````int cas[][] = { {1,{0,16,1},{4,7,8}},
{2,{2,3},{4,5}},
{3,{},{}},
{4,{4,17,5},{7,10,11}},
{5,{6,7},{7,8}},
{6,{},{}},
{7,{8,17,9},{10,1,2}},
{8,{10,11},{10,11}},
{9,{},{}},
{10,{12,16,13},{1,4,5}},
{11,{14,15},{1,2}},
{12,{},{}}  };

for (i=0 ; i<12 ; i++) {
voies[i] = cas[i];
}
``````

``````Voie v = {1,{0,16,1},{4,7,8}};
``````

``````int tab[] = {1,{0,16,1},{4,7,8}};
Voie v = tab;
``````

``````Voie voies[12] = {
{1,{0,16,1},{4,7,8}},
{2,{2,3,},{4,5,}},
{3,{0,},{0,}},
{4,{4,17,5},{7,10,11}},
{5,{6,7,},{7,8,}},
{6,{0,},{0,}},
{7,{8,17,9},{10,1,2}},
{8,{10,11,},{10,11,}},
{9,{0,},{0,}},
{10,{12,16,13},{1,4,5}},
{11,{14,15,},{1,2,}},
{12,{0,},{0,}}
};
``````

0 条评论