memchr

Searches a memory block for a specified character

#include <memory.h>
void *memchr (
        const void *s,
        long c,
        size_t n
)

Arguments

Pointer to a memory block
c Desired character
n Maximum number of bytes to search

Return Value

A pointer to the located character c is returned. NULL is returned if c cannot be found in the memory block.

Explanation

The first occurrence of the character c in the memory block pointed to by s is located and a pointer to the character is returned. At most n bytes of the memory block will be searched.