X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrcmp.c;h=e72e3761bf78a260f77e4037f8a81580c0e2abe8;hb=419762f3c5da2a601e3c7427e25ae01293a73223;hp=9906f49aa07b140883fc420c0c2dd1b91e50c285;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec;p=pdclib diff --git a/functions/string/strcmp.c b/functions/string/strcmp.c index 9906f49..e72e376 100644 --- a/functions/string/strcmp.c +++ b/functions/string/strcmp.c @@ -5,4 +5,12 @@ // This code is Public Domain. Use, modify, and redistribute at will. // ---------------------------------------------------------------------------- -int strcmp( const char * s1, const char * s2 ) { /* TODO */ }; +int strcmp( const char * src_1, const char * src_2 ) +{ + while ( ( *src_1 != '\0' ) && ( *src_1 == *src_2 ) ) + { + ++src_1; + ++src_2; + } + return ( *src_1 - *src_2 ); +}