strlen

Synopsis

#include <string.h>

size_t strlen(const char *s);

size_t strnlen(const char *s, size_t maxlen);

Status

Partially implemented

Conformance

IEEE Std 1003.1-2017

Description

The strlen() function shall compute the number of bytes in the string to which s points, not including the terminating NUL character. The strnlen() function shall compute the smallest of the number of bytes in the array to which s points, not including any terminating NUL character, or the value of the maxlen argument. The strnlen() function shall never examine more than maxlen bytes of the array pointed to by s.

Return value

The strlen() function shall return the length of s; no return value shall be reserved to indicate an error. The strnlen() function shall return the number of bytes preceding the first null byte in the array to which s points, if s contains a null byte within the first maxlen bytes; otherwise, it shall return maxlen.

Errors

No errors are defined.

Tests

Untested

Known bugs

None

See Also

  1. Standard library functions
  2. Table of Contents