FENIX_libc/string/strcmp.c

13 lines
224 B
C
Raw Normal View History

2020-12-01 23:40:03 +00:00
#include <string.h>
int strcmp(const char * s1, const char * s2) {
size_t i = 0;
while(s1[i] != '\0' && s2[i] != '\0') {
if(s1[i] != s2[i]) {
return s1[i] - s2[i];
}
i++;
}
return s1[i] - s2[i];
}