memchr

Full prototype:

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

Purpose and Notes:

Scans through and finds the first occurence of the second paramater passed in (converted to an unsigned char) within the object passed in as the first paramater up to size of the third paramater passed in. It returns a pointer to the location within the first paramter (up to the lenght of the third argument) given where the character passed in as the second paramter was found. If it was not found then the function returns NULL.

Equivilent to strchr except that it works on memory rather than NULL terminated strings, thus why you need to include the length to search as the third argument.

Returns:

void*- The location in which the character was found in the object passed in as the first argument or NULL if it was not found.

Argument 1:

const void*- The object in which you want to search for the character within.

Argument 2:

int- The character (converted to unsigned char for special characters like EOF) in which you want to search for within the object passed in as the first argument.

Argument 3:

size_t- The size of the object you want to search or the size that you want to search up to within an object in bytes.

Example 1
  1    EXAMPLE SOURCE CODE
EXAMPLE TERMINAL CODE