memcmp

Full prototype:

int memcmp(const void*, const void*, size_t);  

Purpose and Notes:

Compares two locations in memory pointed to by the first and second paramater up to the size specified by the third paramater. It looks at the ones and zeros at those memory locations up to the size specified by the third argument and then determines if the first paramter's object is less than (<0), greater than (>0) or equal (==0) to the object passed to the right. Then returns a number that would satisfy the argument in a conditional statement comparing to zero.

Is equivalent to the strcmp function except that it needs to be specified the size of the objects to compare as it doesn't go based on the size up to a null character as objects can have zeros in them.

Returns:

int- A number that is less than zero is returned if the object passed in as the first paramater is less than the object passed in as the second paramter. Likewise zero is passed if they are equal and a number greater than zero if the first paramter's ones and zeros are greater than the second paramater.

Argument 1:

const void*- The first object you wish to compare.

Argument 2:

const void*- The second object you wish to compare.

Argument 3:

size_t-The size of the objects or the size in which you care to compare of each object.

Example 1
  1    EXAMPLE SOURCE CODE
EXAMPLE TERMINAL CODE