title: segfault when concating two strings in small array
body: <p>I started learning C yesterday, so this might be a trivial question, but I still don't get this.</p>
  
  <p>Let's say I have the following code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
      char text[8];
      strcpy(text, "Lorem ");
      puts(text);
      strcat(text, "ipsum!");
      puts(text);
      return 0;
  }
  </code></pre>
  
  <p>This will result in a segmentation fault when (or after) concating the strings. However if I change the size of <code>text</code>from 8 to 9, it doesn't.</p>
  
  <p>Please correct me if I'm wrong but this is what I thought was right:</p>
  
  <p>"Lorem " - size 6 (or 7 with \0)<br>
  "ipsum!" - size 6 (or 7 with \0)<br>
  "Lorem ipsum!" - size 12 (or 13 with \0)</p>
  
  <p>So, where does the 8/9 come from? Is this caused by the implementation of <code>strcat</code>? Or is there something like a minimum array length? Or am I making a stupid beginner's mistake?</p>
  
  <p>Thanks in advance.</p>