title: How to delete all occurrences of a specific char in a double linked list?
body: <p>Can I know why my code does not work? The logic within the if loops seem to be sound so I believe the error is either in the outer for loop or I am not returning the modified list. </p>
  
  <pre><code>struct list* delete_char(struct list* the_list, char value){
      struct list *copy1 = the_list;
      struct list *copy2 = the_list;
      struct list *copy3 = the_list;
      int i = 0;
  
      for (copy1; copy1 -&gt; info != value; copy1 = copy1 -&gt; next){
          if (copy1 -&gt; info == value){
              copy2 = copy1 -&gt; next;
              copy3 = copy1 -&gt; prev;
              copy3 -&gt; next = copy2;
              copy2 -&gt; prev = copy3;
              i ++;
          }
          if (copy1 -&gt; prev == NULL &amp;&amp; copy1 -&gt; info == value){
              copy2 = copy1 -&gt; next;
              copy2 -&gt; prev = NULL;
              i++;
          }
          if (copy1 -&gt; next == NULL &amp;&amp; copy1 -&gt; info == value){
              copy2 = copy1 -&gt; prev;
              copy2 -&gt; next = NULL;
              i++;
          }
      }
  
      if (i == 0){
          printf("The element is not in the list!\n");
      }
  
      return the_list;
  };
  </code></pre>