SHOW:
|
|
- or go back to the newest paste.
| 1 | /* Writing own version of the " strcat( ) " library function which is named mystrcat( ) */ | |
| 2 | #include<stdio.h> | |
| 3 | void mystrcat(char s1[],char s2[]); | |
| 4 | int main(void) | |
| 5 | {
| |
| 6 | char a[999999]; | |
| 7 | char b[999999]; | |
| 8 | gets(a); | |
| 9 | gets(b); | |
| 10 | mystrcat(a,b); | |
| 11 | return 0; | |
| 12 | } | |
| 13 | void mystrcat(char s1[],char s2[]) | |
| 14 | {
| |
| 15 | char s3[80]; | |
| 16 | int i,j; | |
| 17 | for(i=0;s1[i]!='\0';i++) | |
| 18 | {
| |
| 19 | s3[i]=s1[i]; | |
| 20 | } | |
| 21 | for(j=0;s2[j]!='\0';j++) | |
| 22 | {
| |
| 23 | s3[i]=s2[j]; | |
| 24 | i++; | |
| 25 | } | |
| 26 | s3[i]='\0'; | |
| 27 | puts(s3); | |
| 28 | } |