memcmp.c 276 Bytes Edit Raw Blame History 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include <string.h> int memcmp(const void * s1, const void * s2, size_t n) { char * source1 = (char *)s1; char * source2 = (char *)s2; while (n--) { if (*source1 != *source2) { return *source1 - *source2; } source1++; source2++; } return 0; }