memcmp

Compares (with case sensitivity) two blocks of memory (function or macro)

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:Memory Manipulation

Syntax

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

Parameters

s1
(IN) Points to the first object.
s2
(IN) Points to the second object.
length
(IN) Specifies the number of bytes to compare.

Return Values

memcmp returns an integer less than, equal to, or greater than zero, indicating that the object pointed to by s1 is less than, equal to, or greater than the object pointed to by s2.

Remarks

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

See Also

memchr, memcpy, memicmp, memset

Example

  #include <string.h>  
  #include <stdio.h>  
   
  main ()  
  {  
     char   buffer[80];  
     if (memcmp (buffer, "Hello ", 6) < 0)  
     {  
        printf ("Less than\n");  
     }  
  }