0
/*
Here is the piece of code causing segmentation fault
*/
int search_for_data(T_NODE head, int data){
while(head){
if(head->data > data)
head = head->left;
if(head->data < data)
head = head->right;
else
return head->key;
}
return -999999;// in case the node is not found
}
該代碼似乎是拋出少數值的分段錯誤,但其他人可以正常工作。我試圖尋找22,並有分段錯誤。二叉搜索樹中的分段錯誤
非常感謝! 這真的很有幫助! –