Guest User

Untitled

a guest
May 26th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. struct node *delete_val(int value, struct node *head) {
  2.  
  3. struct node *h1 = head;
  4. if (head == NULL) { return NULL;}
  5. if (head->next == NULL) { free(head); return NULL;}
  6. while (h1 != NULL) {
  7. if (h1->next != NULL && h1->next->data == value){
  8. h1->next = h1->next->next;
  9. } else {
  10. h1 = h1->next;
  11. }
  12. free(h1);
  13. return head;
  14. }
  15. }
Add Comment
Please, Sign In to add comment