title: Implementing strcat() using pointers
body: <p>I am reading K&amp;R and trying to do the excercise involving writing a version of strcat (attach one string to the end of the other) using pointers. This is what I have:    </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  void mystrcat(char *s,char *t)
  {
      while(*s++);
      *s--;
      while(*s++ = *t++);
  }
  
  int main()
  {
      int size = 1024;
      char *s1, *s2;
      s1 = malloc(size);
      s2 = malloc(size);
      s1 = "Hello ";
      s2 = "World";
      mystrcat(s1,s2);
      printf("%s",s1);
      return 0;
  }
  </code></pre>
  
  <p>The program runs but crashes straight away, not very experienced with pointers so can't work out the error.</p>