idx x, z ;
for (x = 0 ; x < k ; ++x) {
if (mots[x].mot) {
printf("%s :", mots[x].mot) ;
//Below not working properly how to write all my refs ?
// printf("%i ", mots[x].refs -> cdr ->ref);
// while (mots[x].refs -> cdr) printf("%i ", mots[x].refs -> ref);
printf("\n") ;
如何在我的结构上正确迭代以显示mots [x]的每个引用?
我希望问题很清楚,提前谢谢
答案 0 :(得分:1)
if (mots[x].mot) {
printf("%s :", mots[x].mot) ;
struct node *node = mots[x].refs;
while (node) {
printf("%i ", node->ref);
node = node->cdr;
}
printf("\n");
}