memcmp() — Compare bytes
Format
#include <string.h>
int memcmp(const void *buf1, const void *buf2, size_t count);
General description
The memcmp()
built-in function compares the first
count bytes of buf1 and
buf2.
The relation is determined by the sign of the difference between the values of the leftmost first pair of bytes that differ. The values depend on EBCDIC encoding. This function is not locale sensitive.
Note: When COMPACT is specified, the compiler does
not generate inline code for this function. In this case, you need to take either of the following
actions:
- Define the __METAL_SYSVEC feature test macro to use the system library.
- Define the __METAL_STATIC feature test macro to use the static object library and bind in corresponding data set.
Returned value
Indicates the relationship between buf1 and buf2 as
follows:
- Value
- Meaning
- < 0
- The contents of the buffer pointed to by buf1 less than the contents of the buffer pointed to by buf2
- = 0
- The contents of the buffer pointed to by buf1 identical to the contents of the buffer pointed to by buf2
- > 0
- The contents of the buffer pointed to by buf1 greater than the contents of the buffer pointed to by buf2