memcmp

Compares (with case sensitivity) two blocks of memory.

Library:LibC
Classification:ANSI
Service:Characters and Strings

Syntax

  #include <string.h> 
   
  int memcmp (
     const void   *s1,
     const void   *s2,
     size_t        length);
  

Parameters

s1

(IN) Points to the first object to compare.

s2

(IN) Points to the second object to compare.

length

(IN) Specifies the number of bytes to compare.

Return Values

Returns 0 if the two strings match. Otherwise, it returns an integer less than or greater than 0, depending on whether s1 is lexicographically less than or greater than s2.

Remarks

The memcmp function compares the first length characters of the object pointed to by s1 to the object pointed to by s2.

See Also