liveBook · Manning

Strlen

strlen is a C library function that returns the number of characters in a null-terminated string before its terminating null character.

How 2 Manning books explain it

Modern C, Third Edition

strlen is a C standard-library function that returns the number of characters before the terminating zero in a string.

How it is used
Measures a zero-terminated string before copying, comparing, or sizing storage for it.
How deep it goes
Defines the first-zero rule, array-size distinction, termination requirement, and size_t result without detailing implementation internals.
Examples
Uses argv[0] to size a destination array before copying and comparing the program name.
What you can do after
Apply strlen through the C string library while preserving zero termination and allocating room for the terminator.

Read how Modern C, Third Edition explains strlen →

Modern C

strlen is a C standard library function that returns the number of characters before the null terminator of a string.

How it is used
Uses strlen to measure a null-terminated C string before allocating or copying storage.
How deep it goes
Defines the count and demonstrates allocation and copying, while deferring implementation internals.
Examples
Demonstrates measuring argv[0], sizing a variable-length array, copying characters, and adding the terminating 0.
What you can do after
Apply via the C standard library to measure valid strings and size storage for subsequent operations.

Read how Modern C explains strlen →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.