Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

memchr - Search for a character in memory area

&pagelevel(4)&pagelevel

Definition

#include <string.h>

void *memchr(const void *s, int c, size_t n);

memchr searches for the first occurrence of the character c in the first n bytes of the memory
area to which s points.

Return val.

Pointer to the position of c in area s

if successful.

NULL pointer

if c is not contained in the specified area.

Notes

The function is suitable for processing character arrays containing the null byte (\0), since
memchr does not interpret the null byte as the ’end of text’.

The following two prototypes of the memchr function are applicable to C++:
const void *memchr(const void *s, int c, size_t n);

void *memchr( void *s, int c, size_t n);

See also

memcmp, memcpy, memset