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]的每个引用?
我希望问题已经很清楚了,在此先感谢
最佳答案
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");
}