- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc, const char * argv[]) {
-
- char *s1 = (char *)malloc(sizeof(char) * 20);
- char *s2 = (char *)malloc(sizeof(char) *20);
- printf("请输入字符串1:\n");
- scanf("%s",s1);
- printf("请输入字符串2:\n");
- scanf("%s",s2);
- unsigned long count = strlen(s1);
- strcpy(&s1[count], s2);
-
- printf("%s",s1);
- free(s1);
- free(s2);
- s1 =NULL;
- s2 = NULL;
- return 0;
- }
- 交流交流...
复制代码 |