Guest User

Untitled

a guest
Jan 12th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.15 KB | None | 0 0
  1. void ElementLoeschen(int SucheL)
  2. {
  3.     int Gefunden = 0;
  4.     struct Entry *rootK;
  5.     struct Entry *Buffer = NULL;
  6.  
  7.     rootK = root;
  8.  
  9.  
  10.     if(rootK == NULL)
  11.     {
  12.         printf("Kein Eintrag\n\n");
  13.         return;
  14.     }
  15.     else
  16.     {
  17.         for(rootK;rootK != NULL; Buffer=rootK, rootK=rootK->next)
  18.         {
  19.             if((rootK->data) == SucheL)
  20.             {
  21.                 if(root==rootK)
  22.                 {
  23.                     root = NULL;
  24.                 }
  25.                     else if(Buffer != NULL)
  26.                     {
  27.                         Buffer->next=rootK->next;
  28.                         rootK->next=NULL;
  29.                         rootK=Buffer->next;
  30.                     }
  31.                         else if((rootK->next) == NULL)
  32.                         {
  33.                             Buffer->next=NULL;
  34.                         }
  35.                         else
  36.                         {
  37.                             root=rootK->next;
  38.                         }
  39.                 Gefunden = 1;
  40.             }
  41.         }
  42.     }
  43.  
  44.     printf("\n");
  45.  
  46.     if(Gefunden == 0)
  47.         printf("Kein Eintrag unter dieser Suche\n\n");
  48. }
Add Comment
Please, Sign In to add comment