STRCHR(3P)

✨ PROLOG ✨

okay so real talk before we even get into it πŸ’… this page is part of the POSIX Programmer's Manual. and bestie, heads up β€” the Linux implementation of this interface may differ (so pls go consult the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface might just not be implemented on Linux at all. rude, but that's the situation πŸ™ˆ


πŸŽ€ NAME πŸŽ€

strchr β€” string scanning operation. that's it, that's the whole vibe. it scans strings. icon behavior.


🌈 SYNOPSIS 🌈

#include <string.h>

char *strchr(const char *s, int c);

πŸ’– DESCRIPTION πŸ’–

so the functionality described on this reference page is aligned with the ISO C standard. any conflict between the requirements described here and the ISO C standard is unintentional β€” no drama intended fr. and this volume of POSIX.1‐2017 defers to the ISO C standard. periodt.

now the actual tea: the strchr() function shall locate the first occurrence of c (converted to a char) in the string pointed to by s. and here's the lil detail people forget β€” the terminating NUL character is considered to be part of the string. so yes bestie, strchr() can absolutely find that \0. she's part of the group chat. 🫢


πŸ¦‹ RETURN VALUE πŸ¦‹

upon completion, strchr() shall return a pointer to the byte, or a null pointer if the byte was not found. so: found = pointer, not found = NULL. simple as. no notes. πŸ’…


πŸ”₯ ERRORS πŸ”₯

no errors are defined. literally none. she simply does not fail. main character energy.

the following sections are informative.


πŸ“ EXAMPLES πŸ“

none. (yes really, none. she's self-explanatory like that ✨)


πŸ’œ APPLICATION USAGE πŸ’œ

none. nothing to add, she's just built different.


🧚 RATIONALE 🧚

none. no justification needed, she's iconic.


⭐ FUTURE DIRECTIONS ⭐

none. she's not going anywhere, she's forever. πŸ‘‘


🌸 SEE ALSO 🌸

  • strrchr() β€” her sister, the backwards one, love her tho
  • The Base Definitions volume of POSIX.1‐2017, <string.h>

portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie 🫢 this one's from the POSIX Programmer's Manual, courtesy of IEEE/The Open Group, dated 2017, and she lives at STRCHR(3P). go find ur byte, u got this πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from