title: Segmentation fault, pointer issue
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  typedef struct lista_inteiros
  {
      int valor;
      struct lista_inteiros *next;
  
  }element_int;
  
  void insere_inteiro(element_int **head, element_int **aux, int m);
  void remove_inteiro(element_int **head, element_int **aux, int m);
  
  int main()
  {
      int i = 0;
      element_int *head, *aux;
  
      head = NULL;
  
      for(i = 0; i&lt;6; i++)
      {
          insere_inteiro(&amp;head, &amp;aux, i); 
      }
  
      aux = head;
  
      while(aux)
      {
          printf("%d\n", aux-&gt;valor);
          aux = aux-&gt;next;
      }
  
      aux = head;
      i = 4;
  
      remove_inteiro(&amp;head, &amp;aux, i);
  
      aux = head;
      while(aux)
      {
          printf("%d\n", aux-&gt;valor);
          aux = aux-&gt;next;
      }
  
  
      return 0;
  }
  
  void insere_inteiro(element_int **head, element_int **aux, int m)
  {
      (*aux) = (element_int*)malloc(sizeof(element_int));
      if((*aux) == NULL)
      {
          printf("Error\n");
          exit(1);
      }
  
      (*aux)-&gt;valor = m;
      (*aux)-&gt;next = (*head);
      (*head) = (*aux);
  }
  
  void remove_inteiro(element_int **head, element_int **aux, int m)
  {
      element_int *del;
  
      while((*aux) != NULL)
      {
          if((*head)-&gt;valor == m)
          {
              (*head) = (*head)-&gt;next;
              free(aux);
              (*aux) = (*head);
          }
  
          else if((*aux)-&gt;next-&gt;valor == m)
          {
              del = (*aux)-&gt;next;
              (*aux)-&gt;next = del-&gt;next;
              free(del);
          }
          (*aux) = (*aux)-&gt;next;
      }
  }
  </code></pre>
  
  <p>Baiscally, this prints:</p>
  
  <pre><code>5
  4
  3
  2
  1
  0
  Segmentation Fault
  </code></pre>
  
  <p>And i really cant figure out why. It is supposed to eliminate the number 4, and then print the numbers again. So the desired output is:</p>
  
  <pre><code>5
  4
  3
  2
  1
  0
  5
  3
  2
  1
  0
  </code></pre>
  
  <p>The function <code>insere_inteiro</code> creates a new element and the function <code>remove_inteiro</code> removes one.</p>
  
  <p>Each element of the list has a integer called <code>valor</code>.</p>