home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_03 / 2n03023c < prev    next >
Text File  |  1991-01-11  |  307b  |  18 lines

  1.  
  2.  
  3. /*
  4.  * An implementation of the Standard C library function memcmp.
  5.  */
  6. int memcmp(const void *s1, const void *s2, size_t n)
  7.     {
  8.     const unsigned char *t1 = s1;
  9.     const unsigned char *t2 = s2;
  10.     size_t i;
  11.  
  12.     for (i = 0; i < n; ++i)
  13.         if (t1[i] != t2[i])
  14.             return t1[i] - t2[i];
  15.     return 0;
  16.     }
  17.  
  18.