/*WAP to delet any node from double linked list*/ #include<stdio.h> #include<conio.h> #include<stdlib.h> struct node { int data; struct node *llink; struct node *rlink; }; typedef struct node node; void delete_any(node *); void main() { node *header=NULL; int n; clrscr(); delete_any(header); getch(); } void delete_any(node *temphead) { node *temp; node *p; int key; printf("Enter the value which you want to delete:"); scanf("%d",&key); while(temphead->rlink!=NULL && temphead->data!=key) { temp=temphead; temphead=temphead->rlink; } if(temphead->data==key) { node *temp1; temp1=temphead->rlink; temp->rlink=temp1; temp1->llink=temp; free(temphead); } else { printf("Value not found......"); } }
WAP to delet any double linked list
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment