Advertisement
Kimossab

Remove from List - ED

Jun 10th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. void RemoveFunc(Lista *L, char *cod)
  2. {
  3.     if(L == NULL || cod == NULL)
  4.         return;
  5.  
  6.     NO *aux = L->Inicio;
  7.     NO *ant = NULL
  8.    
  9.     while(aux)
  10.     {
  11.         if(stricmp(aux->Info->cod, cod) == 0)
  12.         {
  13.             if(!ant) //primeiro na lista
  14.                 L->Inicio = aux->Prox;
  15.             else
  16.                 ant->Prox = aux->Prox;
  17.  
  18.             free(aux);
  19.             return;
  20.         }
  21.         ant = aux;
  22.         aux = aux->Prox;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement