我有一棵有结构的树。我需要找到其最大数量(给定)的最小值。在树中找到某物品(C)
Item this_word (link h, int max){
Item word;
if (h == NULL)
return 0;
if (h->item->acc == max){
word = h->item;
this_word(h->l, max);
}
else{
this_word(h->l, max);
this_word(h->r, max);
}
return word;
}
但我得到一个分段错误..
链接变量是一个指针吗?因为你像访问它一样 – BackDoorNoBaby
你的段错误究竟在哪里?你在调试器中运行程序吗?请显示'Item'和'link'类型的定义。 – Martin
@BackDoorNoBaby typedefs是邪恶的 –