c-first-steps

a C playground
Index Commits Files Refs README
commit 1647d9cc959380550cf4050ad2c5c6d6336433d7
parent 23c819c052077bb87612a49f174a2bd2b8840591
Author: Martin J. Klöckner <64109770+klewer-martin@users.noreply.github.com>
Date:   Tue, 24 Nov 2020 08:42:07 -0300

Update ex08_modular.c
Diffstat:
M95.11/guia03/ex08_modular.c | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/95.11/guia03/ex08_modular.c b/95.11/guia03/ex08_modular.c
@@ -1,10 +1,10 @@
 /*    Makes a lexicographical comparison between two strings    */
-/*    similar to strcmp() function from <string.h>            */
+/*    similar to strcmp() function from <string.h>        */
 
 #include <stdio.h>
 
 /*    This function calculates the length of given string
-    and returns the lenghth by its name as a size_t            */
+    and returns the lenghth by its name as a size_t        */
 size_t str_len(const char *str) 
 {
     if(str == NULL)
@@ -17,10 +17,10 @@ size_t str_len(const char *str)
 }
 
 /*    This function is equivalent to strcmp() function from    
-    <string.h> library                                        */
+    <string.h> library                    */
 int str_cmp(const char *str1, const char *str2) 
 { 
-    //    In case one of the given strings is NULL returns 1; 
+//    In case one of the given strings is NULL returns 1; 
     if(str1 == NULL || str2 == NULL)
         return 1;
 
@@ -30,17 +30,17 @@ int str_cmp(const char *str1, const char *str2)
     str1_len = str_len(str1);
     str2_len = str_len(str2);
 
-    //    Assigns the length of the longer string to j;
+//    Assigns the length of the longer string to j;
     j = (str1_len > str2_len) ? str1_len : str2_len; 
 
-    //    The for loop itinirate until the longest str ENDs
+//    The for loop itinirate until the longest str ENDs
     for(i = 0, cmp = 0; i < j; i++) {
 
         aux1 = str1[i];
         aux2 = str2[i];
 
-        //    This statement assigns to cmp the difference between
-        //    the two coresponding chars of str1 and str2
+//        This statement assigns to cmp the difference between
+//        the two coresponding chars of str1 and str2
         if(aux1 < aux2) {
             cmp -= (aux2 - aux1);
         } else if (aux1 > aux2) {