【求助】将其变为递归型
word_t *binarysearch(word_t *dict,char *str, int total)//二分查找,这是子程序{
//int index1;
int mid, start = 0, end = total - 1;
while(start <= end)
{
mid = (start + end) / 2;
if(strcmp((dict+mid)->key, str) < 0)
start = mid + 1;
else if(strcmp((dict+mid)->key, str) > 0)
end = mid - 1;
else
return dict+mid;
}
return NULL;
}将其变为递归,我该了一下一直是错误的,一直报错