Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. ex7 *list_column4(mainList *lst){
  2.  
  3.        
  4.  
  5.         //Insert first value
  6.     if(!lst)
  7.     {
  8.             tmp = insert_head_value(tmp, aux->col4, 1); // primeiro valor da lista principal insere logo
  9.             y++;
  10.             aux = aux->next; // passa para o proximo
  11.         return aux;
  12.     }
  13.     else
  14.     {
  15.         for (; aux != lst; aux = aux->next)
  16.         { //para o resto da lista principal
  17.  
  18.                 tmp2 = search_ex7(tmp, aux->col4); // procura se existe e fica guardado com tmp2
  19.  
  20.                 if (tmp2 == NULL) // se retornar null nao existe
  21.                 {
  22.                         lst = insert_head_value(lst, aux->col4, 1); // logo insere novo valor na lista nova
  23.                         y++;
  24.                 }
  25.             else // existe o valor na lista nova
  26.                 {
  27.                     x = tmp2->rep;
  28.                         x++;
  29.                         tmp2->rep = x;
  30.                 }
  31.  
  32.  
  33.         }
  34.     }
  35.         printf(" VALORES INSERIDOS: %lli",y);
  36.     return lst;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement