一:#include<stdio.h>#include<stdlib.h>char* mycat(char *a,char *b){ char* ret=a; while(*a!='\0') { *a++; } while(*b!='\0') { *a=*b; *a++; *b++; } *a='\0'; return ret;}int main(){ char s1[20]="abcd"; char s2[20]="Abcde"; printf("%s\n",mycat(s1,s2)); return 0;}二:#include<stdio.h>#include<stdlib.h>char* mycat(char *a,char *b){ char* ret=a; while(*a!='\0') { a++; } while(*b!='\0') { *a=*b; *a++; *b++; } *a='\0'; return ret;}int main(){ char s1[20]="abcd"; char s2[20]="Abcde"; printf("%s\n",mycat(s1,s2)); return 0;}
- 2 回答
- 0 关注
- 1268 浏览
添加回答
举报
0/150
提交
取消