42_KFS_LIB/src/string/strncmp.c
2024-09-06 23:08:56 +02:00

13 lines
189 B
C

#include <stddef.h>
int strncmp(const char *s1, const char *s2, size_t n)
{
size_t i = 0;
if (n == 0)
return 0;
while (s1[i] == s2[i] && i < (n - 1))
i++;
return s1[i] - s2[i];
}