Tuesday, 12 July 2011

Search a circularly Linked List..

void srch(node *start)
{
    int userdata;                    /* Data to be searched */
    node *current;              /* Node for travelling the linked list*/
    current=start;
    printf("\nEnter the data to search\n");
    scanf("%d",&userdata);
    while(current->next!=start)
    {
        if(current->data==userdata)
            printf("\n %d  %s  %f\n",current->data);
        current=current->next;
    }
    if(current->next==start && current->data==userdata)
        printf("\n %d  %s  %f\n",current->data);
}

No comments:

Post a Comment