title: C function using strcat with strings
body: <p>I'm trying to learn C. So I've challenged myself to create a function called <code>two()</code> which will effectively "double" a string.</p>
  
  <pre><code>two("foo") // =&gt; "foofoo"
  </code></pre>
  
  <p>But I'm having trouble using <code>strcat()</code> in conjunction with pointers. Here's what I have:</p>
  
  <pre><code>char *two(char *foo);
  
  int main() {
      printf("The value of two(\"foo\") is %s", two("foo"));
  }
  
  char *two(char *foo) {
      return strcat(foo, foo);
  }
  </code></pre>
  
  <p>It compiles but errors on run. Why?</p>
  
  <p>I have a feeling the error resides in using <code>strcat</code> with pointer strings.</p>