📄 strncmp.c
字号:
#include <string.h>
/*lint -e613
strncmp is defined here because some vendors don't implement
it, strcmp, or memcmp correctly; they must treat the bytes
as unsigned chars.
*/
int strncmp(const char *s1, const char *s2, size_t n) {
for ( ; n-- > 0; s1++, s2++)
if (*s1 != *s2)
return (unsigned char)*s1 - (unsigned char)*s2;
else if (*s1 == 0)
return 0;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -