---
name: "memchr"
section: "3"
platform: "macos"
package: "Libc"
version: "1752.120.2"
release: "macOS 26.5"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/memchr"
---

# memchr(3)

locate byte in byte string

## NAME

**memchr** – locate byte in byte string

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<string.h\>**

*void* *\**\

**memchr**(*const void \*s*, *int c*, *size\_t n*);

## DESCRIPTION

The **memchr**() function locates the first occurrence of *c* (converted to an unsigned char) in string *s*.

## RETURN VALUES

The **memchr**() function returns a pointer to the byte located, or NULL if no such byte exists within *n* bytes.

## SEE ALSO

[strchr(3)](/strchr/3.md), [strcspn(3)](/strcspn/3.md), [strpbrk(3)](/strpbrk/3.md), [strrchr(3)](/strrchr/3.md), [strsep(3)](/strsep/3.md), [strspn(3)](/strspn/3.md), [strstr(3)](/strstr/3.md), [strtok(3)](/strtok/3.md), [wmemchr(3)](/wmemchr/3.md)

## STANDARDS

The **memchr**() function conforms to ISO/IEC 9899:1990 (“ISO C90”).
