To reiterate the above, to reliably strcat(A, B) where A and B are strings, memory allocated, either with a variation of malloc() or as an array, should be no less then ( strlen(A) + strlen(B) + 1 ). 1 is for the terminating null character.
It is almost always a better idea to use strncat(), which takes the maximum number of characters to append to string A as an argument, and adds the terminating null character.
Code:
#include <stdio.h>
#include <string.h>
#define LEN 10
int main( void )
{
char A[LEN] = "Quick";
char B[] = " red fox.";
strncat( A, B, LEN - strlen( A ) );
printf( "%s\n", A );
return 0;
}
// Output: "Quick red"; 9 characters + \0