title: How to remove the character at a given index from a string in C?
body: <p>How do I remove a character from a string?</p>
  <p>If I have the string <code>&quot;abcdef&quot;</code> and I want to remove <code>&quot;b&quot;</code> how do I do that?</p>
  <p>Removing the <strong>first</strong> character is easy with this code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
      char word[] = &quot;abcdef&quot;;
      char word2[10];
  
      strcpy(word2, &amp;word[1]);
  
      printf(&quot;%s\n&quot;, word2);
   
      return 0;
  }
  </code></pre>
  <p>and</p>
  <pre><code>strncpy(word2, word, strlen(word) - 1);
  </code></pre>
  <p>will give me the string without the <strong>last</strong> character, but I still didn't figure out how to remove a char in the <strong>middle</strong> of a string.</p>