MEMCMP - compare parts of two strings.

(ANSI Standard)

Usage:

#include <string.h>
i = memcmp( s1, s2, N );

Where:

const void *s1, *s2;
are the strings to be compared.
size_t N;
gives the number of characters to be examined.
int i;
gives the results of the comparison. "i" is zero if the first N characters of the strings are identical. "i" is positive if string "s1" is greater than string "s2", and is negative if string "s2" is greater than string "s1". Comparisons of "greater than" and "less than" are made according to the ASCII collating sequence.

Description:

"memcmp" compares the first N characters of the string "s1" to the first N characters of the string "s2".

Unlike the function "strncmp", "memcmp" does not check for a '\0' terminating either string. Thus it examines a full N characters, even if the strings are not actually that long.

See Also:

expl c lib strncmp

expl c lib strcmp

Copyright © 1996, Thinkage Ltd.