可以先定义两个字符数组 分别存放需要拼接的字符.然后使用strcpy()函数来实现拼接,
/* str_cat.c -- joins two strings */
#include
#include
#define SIZE 80
int main(void)
{
char flower[SIZE];
char addon[] = "s smell like old shoes.";
puts("What is your favorite flower?");
gets(flower);
strcat(flower, addon);
puts(flower);
puts(addon);
return 0;
}
字符只能拼接成字符串
用strcat()函数拼接