PRBLEM / DEVELOPER RESOURCES

C strlen()

← Back to Code Library

CBeginner

Measure bytes in a null-terminated string.

When to use it

Use only when the string is guaranteed to be terminated.

C · Editable example
No visitor code executes on the WordPress server.
Edit this example or check its structure. For Python/SQL select Run for real browser-based output.

Expected output

4

Common mistake and fix

strlen counts bytes, not Unicode characters.

Related concepts: strings, buffers

Explain this code

Measure bytes in a null-terminated string.

Educational examples are not a substitute for a real compiler or version-specific documentation. JavaScript, Python and SQLite demos run in isolated browser contexts when supported; Python and SQL load an online WebAssembly runtime on first use. Other languages receive structural hints, not compiler validation. No visitor code executes on WordPress.