ahamed210

search_header_file

Oct 5th, 2020
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. Node *search(Node *head, int item)
  2. {
  3.     Node *temp;
  4.     temp = head;
  5.     while(temp != NULL){
  6.         if(temp->data == item)
  7.         {
  8.            printf("Yes this item is in the linked list\n");
  9.            return temp;
  10.         }
  11.         temp = temp->next;
  12.     }
  13.     printf("This item is not in the linked list\n");
  14.     return head;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment