title: How to copy or concatenate two char*
body: <p>How do you concatenate or copy char* together?</p>
  
  <pre><code>char* totalLine;
  
  const char* line1 = "hello";
  const char* line2 = "world";
  
  strcpy(totalLine,line1);
  strcat(totalLine,line2);
  </code></pre>
  
  <p>This code produces an error!</p>
  
  <pre><code>segmentation fault
  </code></pre>
  
  <p>I would guess that i would need to allocate memory to totalLine?</p>
  
  <p>Another question is that does the following copy memory or copy data?</p>
  
  <pre><code>char* totalLine;
  
  const char* line1 = "hello";
  
   totalLine = line1;
  </code></pre>
  
  <p>Thanks in advance! :)</p>