Some small problems in C
NOW... Actually this 'mystrcpy' is totally correct. The code causes segementation fault is another function 'mystrdup'...
/*/*/*
The first assignment of this course asked me to write some string manipulation functions without using any string library. I got stuck in the function 'mystrcpy'.
I typed following.
/*
* mystrcpy() copies the string pointed to by src (including the terminating character '\0') to the array pointed to by dst.
* Returns: a pointer to the destination string dst.
*/
char *mystrcpy (char *dst, const char *src)
{
/* Complete the body of the function */
int i;
while(src[i]!='\0'){
dst[i]=src[i];
i++;
}
dst[i]='\0';
return dst;
}
But terminal showed 'segementation fault'. I'm still thinking about this one.
*\*\*\

浙公网安备 33010602011771号