strnul(3) Library Functions Manual strnul(3)

strnul - string search NUL

gnulib - The GNU Portability Library

#include <string.h>
char *strnul(char *s);
const char *strnul(const char *s);

strnul() calculates the position of the terminating null byte ('\0') in the string pointed to by s.

It is equivalent to both of the following expressions:


s + strlen(s)
strchr(s, '\0')

strnul() returns a pointer to the terminating null byte in the string pointed to by s.

For an explanation of the terms used in this section, see attributes(7).

Interface Attribute Value
strnul () Thread safety MT-Safe

GNU.

gnulib 202607.

strlen(3), strchr(3), string(3)

2026-02-25 Linux man-pages 6.18