Is this way to search recursively correct?in a linked list...the answer is right..but in the video sir has done a bit differently

bool searchrec(node *head,int data)
{
bool a;
if(head==0)
return false;
else
{
a=searchrec(head->next,data);
}
if(head->data==data)
{
return true;
}
else
{
return (a||false);
}
}

hey @amehta12 share this code using ide.codingblocks.com

  • A special url will be generated, share that url with me


It’s not readable here.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.