Advertisement
Guest User

Untitled

a guest
May 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. int remover(node*h, int key){
  2. node*aux=h;
  3. for(h=h->next;h;h=h->next){
  4. if(h->info==key)
  5. break;
  6. if(h->next==NULL)
  7. return 0;
  8. }
  9.  
  10. for(h;h;h=h->next){
  11. if(h->next==NULL){
  12. h->info=NULL;
  13. break;
  14. }
  15. h->info=h->next->info;
  16. }delete_last(aux);
  17. return 1;
  18. }
  19.  
  20. int delete_last(node * head) {
  21. node *temp = head;
  22. node *t;
  23. while(temp->next != NULL)
  24. {
  25. t=temp;
  26. temp=temp->next;
  27. }
  28. free(t->next);
  29. t->next=NULL;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement