char *my_strncpy(char *dest, const char *src, int count)
{
assert(dest&&src);//检测参数是否为空指针
while (count) //复制count个字符,循环count次
{
*dest++ = *src++;
count--;
}
if (*(dest) != '\0')
*(dest + 1) = '\0';
return dest;
}
char *my_strncpy(char *dest, const char *src, int count)
{
assert(dest&&src);//检测参数是否为空指针
while (count) //复制count个字符,循环count次
{
*dest++ = *src++;
count--;
}
if (*(dest) != '\0')
*(dest + 1) = '\0';
return dest;
}