Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void delete_by_name()
- {
- node *temp;
- node *list=head;
- {
- char x;
- printf("Enter the Book Name:\n");
- scanf(" %[^\n]", x);
- if(head==NULL)
- {
- printf("There's Nothing Still.\n");
- }
- else
- {
- if(head->b==x)
- {
- temp=head;
- head=temp->next;
- free(temp);
- }
- else if(tail->b==x)
- {
- temp=tail;
- temp->prev->next=NULL;
- tail=temp->prev;
- free(temp);
- }
- else
- {
- while(list->next->b!=x && list->next->next!=NULL)
- {
- list=list->next;
- }
- temp=list->next;
- temp->prev->next=temp->next;
- temp->next->prev=temp->prev;
- free(temp);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement