title: My string concatination is doubling its result each time, why?
body: <p>I'm basically just taking a string and appending / concatting with another string.  The first run through produces the desired results, but the 2nd, 3rd and so on results seem to be doubling the src string.  Combining things with jQuery is super simple, not sure whats going on here in C.  Should I be using memset? or calloc?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main(void) {
    const char* name = "Michelle";
    char *ptr;
    char dest[30];
    char yourName[30];
    char dots[] = "..";
    int i;
  
    for (i=0;i&lt;4;i++)
    {
      if (strlen(name) &gt; 5)
      {
        sprintf(yourName, "%s", name);
        strncpy(dest, yourName, 3);
        ptr = strcat(dest, dots);
        sprintf(yourName, "%s", ptr);
        printf("%s\n", yourName);
      }
    }
  
    return 0;
  }
  </code></pre>
  
  <p>I'm expecting to see results such as</p>
  
  <p>Michelle becomes Mic..
  This works, however if my name structure has 4 names and they were all Michelle the results are...</p>
  
  <pre><code>Mic..
  Mic....
  Mic......
  Mic........
  </code></pre>