自定义实现复制函数
<span style="font-size:18px;">/strcpy函数
void strCpy1(char dest[], char source[])
{
int i = 0;
while (source[i] != '\0') {
dest[i] = source[i];
i++;
}
dest[i] = '\0';
}
void strCpy2(char *dest, char *source)
{
while ((*dest++ = *source++) != '\0') {
}
}
//strlen函数
unsigned long strLen(char str[])
{
unsigned long length = 0;
int i = 0;
while (str[i] != '\0') {
length++;
i++;
}
return length;
}
</span>
转载于:https://blog.51cto.com/9217856/1563751