Linear search function

In the video,
the linear search in linked list code, first a new temp node was created, initialized with head, the (temp!=NULL) was checked.
But then it was done as head->data and head=head->next. Shouldn’t this be temp->data and temp=temp->next instead of head??

Yes right. It should be temp only as we should not lose head of our original linked list.

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.