Name
memicmp - Compares buffers byte-by-byte.
Syntax
#include <memory.h>
#include <string.h>
int memicmp (buf1, buf2, count)
void *buf1;
void *buf2;
unsigned count;
Description
The memicmp function compares the first count characters of
buf1 and buf2 byte-by-byte, without regard to the case of
letters in the two buffers; that is, uppercase (capital) and
lowercase letters are considered equivalent. All uppercase
letters in buf1 and buf2 are converted to lowercase before
the comparison. The memicmp function returns a value
indicating the relationship of buf1 and buf2, as follows:
Value Meaning
Less than zero buf1 less than buf2
Zero buf1 identical to buf2
Greater than zero buf1 greater than buf2
Return Value
The memicmp function returns an integer value, as described
above.
See Also
memccpy(S), memchr(S), memcmp(S), memcpy(S), memset(S)
Example
#include <memory.h> #include <stdio.h> #include <string.h>
char first[100], second[100]; int result;
main()
{
strcpy(first, "Those Who Will Not Learn from
History");
strcpy(second,"THOSE WHO WILL NOT LEARN FROM their
mistakes");
/* Note that the 29th letter is right here ^ */
result = memicmp(first,second,29); /* result is 0
*/
printf("%d\n",result);
}
Output:
0
This program uses memicmp to compare the the first 29
letters of the strings named first and second without regard
to the case of the letters.
(printed 6/18/89)