Home | Previous Page | Next Page   Function Descriptions >

bycmpr( )

The bycmpr( ) function compares two groups of contiguous bytes for a given length. This function returns the result of the comparison.

Syntax

mint bycmpr(byte1, byte2, length)
   char *byte1;
   char *byte2;
   mint length;
byte1
is a pointer to the location at which the first group of contiguous bytes starts.
byte2
is a pointer to the location at which the second group of contiguous bytes starts.
length
is the number of bytes to compare.

Usage

The bycmpr( ) function performs a byte-by-byte comparison of the two groups of contiguous bytes until it finds a difference or until it compares length number of bytes. The bycmpr( ) function returns an integer whose value (0, -1, or +1) indicates the result of the comparison between the two groups of bytes.

The bycmpr( ) function subtracts the bytes of the byte2 group from those of the byte1 group to accomplish the comparison.

Return Values

0
The two groups are identical.
-1
The byte1 group is less than the byte2 group.
+1
The byte1 group is greater than the byte2 group.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]