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