Utility Functions and C Language Reference > C Language Reference > Alphabetical List of Functions > memcmp

memcmp

Example: memcmp Buffer Manipulation Functions

Compares two memory buffers.

int memcmp( const void *s1, const void *s2, size_t n); 

s1 The name of a buffer.
s2 The name of a buffer.
n The number of characters to search at the beginning of the buffer.

Return Values

Returns the value indicating the relationship between the buffers:

Return value Description
<0 buffer1 is less than buffer2
0 buffer1 is the same as buffer2
>0 buffer1 is greater than buffer2

For memcmp details, refer to your C language documentation.