'\" t .\" Copyright 1993, David Metcalfe .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .TH memchr 3 2026-08-10 "Linux man-pages 6.19" .SH NAME memchr \- memory search character .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .BR #include\~ " // see memory.h(3head)" .P .BR "void *memchr(" "size_t n;" .BI " const void " s [ n "], int " c ", size_t " n ); .fi .SH DESCRIPTION .BR memchr () scans the initial .I n bytes of the memory area pointed to by .I s for the first instance of .IR c . .P Both .I c and the bytes of the memory area pointed to by .I s are interpreted as .IR "unsigned char" . .SH RETURN VALUE .BR memchr () returns a pointer to the matching byte or NULL if the character does not occur in the given memory area. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ .na .nh .BR memchr () T} Thread safety MT-Safe .TE .SH STANDARDS C11, POSIX.1-2008. .SH HISTORY POSIX.1-2001, C89, SVr4, 4.3BSD. .SH SEE ALSO .BR memory.h (3head), .BR memrchr (3), .BR wmemchr (3)