Tuesday, 12 July 2011

Search a Doubly Linked List..

void srch(node *current)
{
    int userdata;

int flag=0;    printf("\nEnter the data to search\n");
    scanf("%d",&userdata);
    while(current->next!=NULL)
    {
        if(current->data==userdata)

{
         flag=1;
printf("\n%d\n",current->data);
}        current=current->next;
    }
    if(current->next==NULL && current->data==userdata)

{  flag=1;       
printf("\n%d\n",current->data);
}
if (flag==0)
printf("\n No match Found");
}

No comments:

Post a Comment