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

# memmem(3)

locate a byte substring in a byte string

## NAME

**memmem** – locate a byte substring in a byte string

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

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

*void \**\

**memmem**(*const void \*big*, *size\_t big\_len*, *const void \*little*, *size\_t little\_len*);

## DESCRIPTION

The **memmem**() function locates the first occurrence of the byte string *little* in the byte string *big*.

## RETURN VALUES

If *big\_len* is smaller than *little\_len*, if *little\_len* is 0, if *big\_len* is 0 or if *little* occurs nowhere in *big*, NULL is returned; otherwise a pointer to the first character of the first occurrence of *little* is returned.

## SEE ALSO

[memchr(3)](/memchr/3.md), [strchr(3)](/strchr/3.md), [strstr(3)](/strstr/3.md)

## CONFORMING TO

**memmem**() is a GNU extension.

## HISTORY

The **memmem**() function first appeared in FreeBSD 6.0.

## AUTHORS

Pascal Gloor ⟨pascal.gloor@spale.com⟩

## BUGS

This function was broken in Linux libc up to and including version 5.0.9 and in GNU libc prior to version 2.1.
