Linked list search function

 void search(struct node *start, int num2)
 {
struct node *p=start;
int pos=1;
while(p!=NULL)
{
             if(p->info==num2)
             {
             printf("%d found at pos %d",num2);
            return;
             }
             
			 p=p->link;
}
printf("num2 %d not found in the listn", num2);
}

Previous Post
Linked list function to count the number of nodes
Next Post
Function to reverse a linked list

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Menu