char s1[] = "three";
char s2[] = "two";
//缓冲区必须足够容纳整个结果
char s3[64];
strcpy(s3, s1);
strcat(s3, ", ");
strcat(s3, s2);
//s3 is "three, two"
//strncat 从不越界写入缓冲区
strncat(s3, ", one", sizeof s3 - strlen(s3) - 1);
//s3 is "three, two, one"
char sGo[64];
snprintf(sGo, sizeof sGo, "%s, %s", s3, "go!");
//sGo is "three, two, one, go!"
//相邻的字面量由编译器连接
const char *literal = "three, " "two";
//literal is "three, two"
printf("sGo is %s\n", sGo);
printf("literal is %s\n", literal);