title: Size definition of strcat() function
body: <p>The question is why should I define size of string (<code>string[]</code> should be <code>string[some-number]</code>)
  When the program is as following it gives me <code>Abort trap: 6</code>:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main(void)
  {
    char buffer1[] = "computer";
    char string[]="program";
    strcat( buffer1, string );
    printf( "buffer1 = %s\n", buffer1 );
  
  }
  </code></pre>
  
  <p>This is the program from <a href="http://www.tutorialspoint.com/cprogramming/c_data_types.htm" rel="nofollow">http://www.tutorialspoint.com/cprogramming/c_data_types.htm</a> it works fine:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main ()
  {
     char str1[12] = "Hello";
     char str2[12] = "World";
     char str3[12];
     int  len ;
  
     /* copy str1 into str3 */
     strcpy(str3, str1);
     printf("strcpy( str3, str1) :  %s\n", str3 );
  
     /* concatenates str1 and str2 */
     strcat( str1, str2);
     printf("strcat( str1, str2):   %s\n", str1 );
  
     /* total lenghth of str1 after concatenation */
     len = strlen(str1);
     printf("strlen(str1) :  %d\n", len );
  
     return 0;
  }
  </code></pre>
  
  <p>What is the mistake? Even if I define all of the sizes of strings in my program, my code still gives <code>Abort trap:6</code>?</p>