title: Concatenate two strings without using strcat
body: <p>I wrote a function to concatenate two strings (<code>s</code> = <code>&quot;computer&quot;</code>; <code>t</code> = <code>&quot;keyboard&quot;</code>), but my code only returns <code>&quot;keyboard&quot;</code>. Please point out the mistakes.</p>
  <pre><code>char *concat(char *s, char *t) {
      s = malloc((strlen(s) + strlen(t) + 1) * sizeof(char));
      char *p = s;
      while (*p != '\0') {
          ++p;
      }
      while (*t != '\0') {
          *p++ = *t++;
      }
      *p = '\0';
      return s;
  }
  </code></pre>
  <p>I do not want to use <code>strcat()</code>. This is a test program from Stepik, so I cannot change anything in the <code>main</code> function.
  <strong>Here is the question: <em><strong>Write a function which receives two character pointers and returns a new character pointer representing their concatenation.</strong></em></strong></p>