memcmp()

compare two memory regions 

Function


SYNOPSIS

#include <string.h>

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


DESCRIPTION

The memcmp() function compares n bytes of two regions of memory, treating each byte as an unsigned character. It returns an integer less than, equal to, or greater than zero according to whether s1 is lexicographically less than, equal to, or greater than s2.


PARAMETERS

s1 

Points to the first buffer to compare.

s2 

Points to the second buffer to compare.

n 

Is the number of bytes to compare.


RETURN VALUES

If, when taken to be unsigned characters, the first n bytes of s1 are lexicographically equal to those of s2, memcmp() returns zero. Otherwise, it returns a negative or positive number depending upon whether s1 is lexicographically less than or greater than s2.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
strcoll(), strncasecmp(), strncmp()


PTC MKS Toolkit 10.2 Documentation Build 28.