Search Particular Element From Singly Linked List
int search(int num)
{
int flag = 0;
struct node *temp;
temp = start;
while(temp!=NULL)
{
if(temp->data == num)
return(1); //Found
temp = temp->next;
}
if(flag == 0)
return(0); // Not found
}
No comments:
Post a Comment