home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_11 / 1011012c < prev    next >
Text File  |  1992-09-03  |  281b  |  13 lines

  1. /* strcmp function */
  2. #include <string.h>
  3.  
  4. int (strcmp)(const char *s1, const char *s2)
  5.     {    /* compare unsigned char s1[], s2[] */
  6.     for (; *s1 == *s2; ++s1, ++s2)
  7.         if (*s1 == '\0')
  8.             return (0);
  9.     return ((*(unsigned char *)s1
  10.         < *(unsigned char *)s2) ? -1 : +1);
  11.     }
  12.  
  13.