12 lines
224 B
C
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];
|
|
}
|