我有一棵有結構的樹。我需要找到其最大數量(給定)的最小值。在樹中找到某物品(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是邪惡的 –