bcmp() — Compare bytes in memory

Standards

Standards / Extensions C or C++ Dependencies
XPG4.2
Single UNIX Specification, Version 3
both  

Format

#define  _XOPEN_SOURCE_EXTENDED 1
#include <strings.h>

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

General description

The bcmp() function compares the first n bytes of the area pointed to by s1 with the area pointed to by s2.

Note: The bcmp() function has been moved to the Legacy Option group in Single UNIX Specification, Version 3 and may be withdrawn in a future version. The memcmp() function is preferred for portability.

Returned value

If s1 and s2 are identical, bcmp() returns 0. Otherwise, bcmp() returns nonzero. Both areas are assumed to be at least n bytes long.

If the value of n is zero, bcmp() returns 0.

There are no errno values defined.

Related information