#include <assert.h>
//比较字符串
int mystrcmp(const char *s1, const char *s2)
{
assert( s1 != NULL && s2 != NULL);
while( *s1 != '\0' || *s2 != '\0')
{
if( *s1 != *s2)
{
return *s1-*s2;
}
s1++;
s2++;
}
return 0;
}
C语言字符函数strcmp的实现
于 2021-12-18 16:09:43 首次发布