ustrrchr(3alleg4)

✨ ustrrchr β€” the last-one-standing finder πŸ’…

okay bestie, we're in the Allegro manual today (that's the 3alleg4 corner of the docs, Allegro game programming library, yes ma'am) and the function on the menu is ustrrchr β€” she finds the last occurrence of a character in a string. not the first. the LAST. she's the one who shows up at the end of the party and knows exactly where everybody went πŸŽ€


✨ SYNOPSIS ✨

#include <allegro.h>

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

that's it, that's the whole vibe. one include, one function signature, zero drama πŸ¦‹


🌸 DESCRIPTION 🌸

So here's the tea: ustrrchr finds the last occurrence of the character c in the string s. Not the first one β€” that's her sister's job (hi ustrchr, we'll get to you). She scans all the way through and gives you the final match. lowkey iconic behavior, ngl.

Example, because we love a demonstration πŸ’–:

char *p = ustrrchr("one,two,three,four", ',');

(that comma she's hunting for? it's the one right before four. the last comma. the final comma. the main character comma. periodt.)


🫢 RETURN VALUE 🫢

  • She hands you back a pointer to that last occurrence of c in s πŸ’«
  • But if there's no match anywhere in there? You get NULL. no match, no pointer, no crumbs. 😭

πŸ‘‘ SEE ALSO πŸ‘‘

the whole squad, go say hi:


okay that's the whole page, bestie, you ate that 🌈✨ this was Allegro, version 4.4.3, ustrrchr(3alleg4), and honestly? she slays. go find your last comma. πŸ’…πŸŽ€πŸ¦‹