MEMRCHR(3pub)

πŸ’– MEMRCHR(3pub) β€” the last one, bestie πŸ’–

okay so picture this: you're deep in a memory block, you're looking for a character, and there's like... more than one of them. bestie, memchr(3) is gonna hand you the first one and ghost you. memrchr is the one who finds the last occurrence, and honestly? main character energy. this lives in the Publib C Programmer's Manual, section 3pub. πŸŽ€


✨ NAME ✨

memrchr β€” find last occurrence of a character within another memory block

it's giving "search backwards, but make it a whole function." πŸ¦‹


✨ SYNOPSIS ✨

#include <publib.h>
void *memrchr(const void *v, int c, size_t size);

✨ DESCRIPTION ✨

okay so memrchr finds the last occurrence of character c within memory block v, of length size. that's it. that's the whole vibe. no cap. πŸ’…

lowkey the mirror image of memchr(3) β€” same energy, but it looks from the other end. πŸ™ˆ

✨ RETURN VALUE ✨

memrchr returns a pointer to the match, if it finds any πŸ’– β€” or a null pointer if it doesn't 😭. so like, always check it before you dereference, bestie. that's the vibe check that matters. 🫢


✨ SEE ALSO ✨


✨ AUTHOR ✨

Lars Wirzenius (lars.wirzenius@helsinki.fi) πŸ‘‘ β€” the icon who wrote this, we stan.


and that's the whole page, bestie ✨ this was Publib, the C Programmer's Manual, page MEMRCHR(3pub) β€” go find your last character and slay πŸ’…πŸ’–πŸŒΈ

πŸ“¦ where this page comes from