Update 'src/string/strncmp.c'

This commit is contained in:
Heath Mitchell 2022-11-24 13:30:46 +01:00
parent ddec761f61
commit ee42660ea5

View file

@ -7,5 +7,5 @@ int strncmp(const char *s1, const char *s2, size_t n)
size_t i = -1;
while (++i < n - 1 && s1[i] != '\0' && s2[i] != '\0'
&& s1[i] == s2[i]) ;
return (s1[i] - s2[i]);
return ((unsigned char) s1[i] - (unsigned char) s2[i]);
}