#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *p,*p1,*p2;
p1=(char *)malloc(sizeof(char));
scanf("%s",p1);
p2=(char *)malloc(sizeof(char));
scanf("%s",p2);
printf("before cat:");
printf("%s ",p1);
printf("%s\n",p2);
p=(char *)malloc(sizeof(char)*(strlen(p1)+strlen(p2)+1));
strcpy(p,p1);
strcat(p,p2);
printf("after cat:");
printf("%s\n",p);
}
输入2个随机长度字符串,将2个字符串拼接
最新推荐文章于 2023-11-03 15:57:42 发布