标签:col har c语言 printf can content 教程 输入 string
123
abc
123abc
1 #include <stdio.h> 2 #include <string.h> 3 4 void str_cat(char s1[], char s2[]) 5 { 6 int l1 = strlen(s1); 7 int l2 = strlen(s2); 8 int i; 9 10 for(i = l1; i < l1 + l2; i++) 11 { 12 s1[i] = s2[i-l1]; 13 } 14 15 s1[i] = ‘\0‘; 16 } 17 18 int main(int argc, char const *argv[]) 19 { 20 char s1[81], s2[81]; 21 22 scanf("%s", s1); 23 scanf("%s", s2); 24 25 str_cat(s1, s2); 26 27 printf("%s\n", s1); 28 return 0; 29 }
标签:col har c语言 printf can content 教程 输入 string
原文地址:http://www.cnblogs.com/hello-lijj/p/7857842.html