Advertisement
Guest User

Remove Node3

a guest
Apr 21st, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. void Delete ( struct list **current, const int data )
  2. {
  3.     struct list *tmp  = *current;
  4.     struct list *prev = NULL;
  5.  
  6.     while ( tmp != NULL )
  7.     {
  8.         struct list *next = tmp->next;
  9.         if ( tmp->age == data )
  10.         {
  11.             free( tmp );
  12.  
  13.             if ( prev )
  14.             {
  15.                 prev->next = next;
  16.             }
  17.             else
  18.             {
  19.                 *current = next;
  20.             }
  21.         }
  22.         else
  23.         {
  24.             prev = tmp;
  25.         }
  26.  
  27.         tmp = next;
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement