strlen(3)

๐Ÿ’– strlen(3) โ€” string length, but make it cute ๐Ÿ’–

okay so bestie, welcome to the glow-up of strlen(3) from the Library Functions Manual. yes we're doing libc today and yes you're gonna understand it. periodt.


โœจ NAME โœจ

strlen โ€” string length. that's it, that's the whole vibe. it counts. ๐Ÿ’…


๐Ÿ“š LIBRARY ๐Ÿ“š

Standard C library (libc, -lc). the classic. the blueprint. the one you already linked without thinking about it. ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <string.h>

size_t strlen(const char *s);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so like. strlen() calculates the length of the string pointed to by s, and the way that it does that is by excluding the terminating null byte ('\0'). that last part is the whole entire plot twist, bestie. the '\0' is the vibe-ruiner of the byte count. it does not get included. it does not get counted. it stays outside. ๐Ÿ˜Œ

it's equivalent to this, no cap:

strnul(s) - s

like it's literally just pointer maths wearing a cute little outfit. pointer to the null minus pointer to the start. iconic behaviour honestly.


๐ŸŽ€ RETURN VALUE ๐ŸŽ€

strlen() returns the number of bytes in the string pointed to by s. bytes, not characters, not graphemes, not feelings. bytes. โœจ


๐Ÿ’œ ATTRIBUTES ๐Ÿ’œ

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

  • Interface: strlen()
  • Attribute: Thread safety
  • Value: MT-Safe

yes bestie, MT-Safe. she's safe to call from multiple threads at once. multithreaded main character energy. ๐Ÿ‘‘


๐ŸŒˆ STANDARDS ๐ŸŒˆ

C11, POSIX.1-2008.


โญ HISTORY โญ

POSIX.1-2001, C89, SVr4, 4.3BSD. she's been around. she's seen things. she's still the moment. ๐Ÿ’€โœจ


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘


fr fr, the only thing you have to remember: no null byte in the count. that's the whole tea. ๐Ÿ“

that's the page, bestie!! this one shipped as part of Linux man-pages 6.20, dated 2026-08-10, and honestly? she ate. mwah. ๐Ÿ’–๐ŸŽ€๐Ÿฆ‹๐Ÿงšโ€โ™€๏ธ

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: Linux-man-pages-copyleft
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms