strcmp.c (355B)
1 #include "../stdint.h" 2 3 int strcmp (const char *s1, const char *s2) { 4 5 int b_value = 1; 6 7 while (1) { 8 9 if (*s1 == '\0' && *s2 == '\0'){ 10 b_value = 0; 11 break; 12 } 13 14 if (*s1 != *s2) { 15 b_value = (int)*s1 - (int)*s2; 16 break; 17 } 18 19 s1++; s2++; 20 21 } 22 23 return b_value; 24 }