add: strcmp
This commit is contained in:
parent
f6c6091beb
commit
53faf0936e
10
src/string/strcmp.c
Normal file
10
src/string/strcmp.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
int strcmp(const char *s1, const char *s2)
|
||||||
|
{
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
while (s1[i] == s2[i] && s1[i] != '\0')
|
||||||
|
i++;
|
||||||
|
return s1[i] - s2[i];
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user