Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

memcmp - compare bytes in memory

&pagelevel(4)&pagelevel

Syntax

#include <string.h>

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

Description memcmp() compares the contents of the first n bytes of the memory areas to which s1 and

s2 point.

s1 and s2 are pointers to the memory areas to be compared.

n is an integer value that specifies the number of bytes to be compared.

Return val.

Integer value, which may be:

< 0

In the first n bytes, the contents of s1 are lexically smaller than the contents
of s2.

0

In the first n bytes, the contents of s1 and s2 are of equal lexical size (i.e.
identical).

> 0

In the first n bytes, the contents of s1 are lexically larger than the contents
of s2.

Notes

This function is suitable for processing character arrays, which, in contrast to character
strings, need not be terminated by the null byte (\0).

See also

memchr(), memcpy(), memset(), string.h.