]> pd.if.org Git - pdclib/blobdiff - functions/string/strcmp.c
Reviewed.
[pdclib] / functions / string / strcmp.c
index 9906f49aa07b140883fc420c0c2dd1b91e50c285..e72e3761bf78a260f77e4037f8a81580c0e2abe8 100644 (file)
@@ -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 );
+}