Warning of "Control may reach end of non-void function"
- by Cloud_cal
I ran a C++ program in Xcode, and encountered a warning of "Control may reach end of non-void function". Here is the code:
Node* search(Node* head, int x)
{
if(!head)
return NULL;
else if(x == head->key)
return head;
else if(x < head->key)
search(head->lchild, x);
else
…