13 lines
189 B
C
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];
|
|
}
|