C programming string.h function - int memcmp(const void *str1, const void *str2, size_t n)

www.ig‮i‬ftidea.com

The memcmp() function is used to compare the first n bytes of two memory areas pointed to by str1 and str2. The function returns an integer less than, equal to, or greater than zero if the first n bytes of str1 are found, respectively, to be less than, to match, or be greater than the first n bytes of str2.

The function has the following signature:

int memcmp(const void *str1, const void *str2, size_t n);

Here, str1 and str2 are pointers to the memory areas to be compared, and n is the number of bytes to compare. The function returns an integer value that indicates the result of the comparison.