FENIX_libc/string/strcmp.c
2020-12-01 17:40:03 -06:00

12 lines
224 B
C

#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];
}