标签:char com follow returns cte nta some course turn
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.
标签:char com follow returns cte nta some course turn
原文地址:https://www.cnblogs.com/lyc4891/p/10888058.html