title: Copy/concatenate dynamically allocated C style strings
body: <p>I am trying to write a function to concatenate two dynamically allocated C-style strings. Am I correct in my design that you first would have to copy the destination to a temp <code>char[]</code>, delete the original memory allocation, get the length of the two <code>char[]</code>, allocate new memory with that new length then copy the chars to the <code>dest[]</code>?</p>
  
  <p>So pseudo code:</p>
  
  <pre><code>void concat(char* dest, char *source)
  {
      char temp = dest;
  
      delete [] dest;
  
      char dest = new char [new size];
  
      copy temp to dest;
  
      copy source to dest;
  }
  </code></pre>
  
  <p>Am I fundamentally misunderstanding this?</p>