memcmp() Compare Characters from Two Buffers
#include <memory.h> Required for declarations only
#include <string.h> Use either string.h or memory.h
int memcmp(buf1,buf2,cnt);
char *buf1; First buffer
char *buf2; Second buffer
unsigned cnt; Number of characters
memcmp() compares 'cnt' characters of 'buf1' and 'buf2'
lexicographically ('a' is less than 'b', 'b' is equal to 'b', and 'c'
is greater than 'b').
Returns: A value indicating the relationship between the two
buffers:
Result Value Returned
'buf1' < 'buf2' < 0
'buf1' == 'buf2' 0
'buf1' > 'buf2' > 0
Notes: Case matters: 'a' does not equal 'A'.
-------------------------------- Example ---------------------------------
The following statement compares the first 100 bytes of 'buffr1' and
'buffr2'.
#include <memory.h>
char buffr1[100], buffr2[100];
int comp;
main()
{
comp = memcmp(buffr1,buffr2,100);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster