title: How to concatenate two strings where the source string should be appended before the destination string?
body: <p>I'm stuck at yet another C problem. How can I concatenate two strings with the second string being inserted before the first string?</p>
  
  <p>This is what I came up with. Unfortunately I'm stuck at all these pointer to chars, char arrays et cetera.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  int main(int argc, char* argv[] )
  {
    char* output;
    int i;
    for(i = 9; i &gt; 0; i--)
    {
      unsigned int value = (unsigned int)i;
      char buffer[20];
      sprintf(buffer, "%u", value);
  //    strcat(ouput, buffer);  // append before the string.
      // first loop: 9
      // second loop: 89
      // third loop: 789
    }
  
    printf("%s", output);
  }
  </code></pre>
  
  <p>How must I correct my code to make it work? I guess I have to somehow set the output variable to empty. When do I need fixed widths for the char array or the pointer? 20 was just a random guess from me.</p>