int my_strcmp(const char *arr1, const char *arr2)
{
assert(arr1&&arr2);
while ((*arr1) == (*arr2))
{
if (*arr1 == '\0')
return 0;
arr1++;
arr2++;
}
return *arr1 - *arr2;
}
实现strcmp
最新推荐文章于 2023-09-23 15:02:12 发布
int my_strcmp(const char *arr1, const char *arr2)
{
assert(arr1&&arr2);
while ((*arr1) == (*arr2))
{
if (*arr1 == '\0')
return 0;
arr1++;
arr2++;
}
return *arr1 - *arr2;
}