Guest User

Untitled

a guest
May 16th, 2018
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void usun(struct lista **head, int x){
  2. if(*head){
  3. struct lista *walker=(*head);
  4. while(walker){
  5. if(walker->key==x){
  6. if(walker->next==NULL && walker->prev==NULL){
  7. free(walker);
  8. free(head);
  9.  
  10.  
  11. }else if(walker->next==NULL){
  12. walker->prev->next=NULL;
  13. free(walker);
  14.  
  15. }else if(walker->prev==NULL){
  16. (*head)=walker->next;
  17. walker->next->prev=NULL;
  18.  
  19. free(walker);
  20.  
  21.  
  22.  
  23.  
  24. }else{
  25. walker->prev->next=walker->next;
  26. walker->next->prev=walker->prev;
  27. }
  28.  
  29. }
  30. walker=walker->next;
  31. }
  32. free(walker);
  33. };
  34. }
RAW Paste Data