ustrchr(3)
π ustrchr β the Allegro manual, but make it a group chat π
okay bestie so you're in the Allegro game programming library, section 3 of the manual, and the star of today's episode is ustrchr β she finds the first occurrence of a character in a string. that's it. that's the girl. she's simple, she's reliable, she's giving β¨search-and-you-shall-findβ¨ energy.
β¨ NAME β¨
ustrchr β Finds the first occurrence of a character in a string. Allegro game programming library. π
πΈ SYNOPSIS πΈ
#include <allegro.h>
char *ustrchr(const char *s, int c);
like. look at her. two args. zero drama. π
π¦ DESCRIPTION π¦
Finds the first occurrence of the character c in the string s. that's the whole vibe β she walks down the string and the SECOND she spots your lil character she goes "found it, periodt" and points right at it. π«Ά
Example, because we love a demo:
char *p = ustrchr("one,two,three,four", ',');
in this scenario p is gonna point at the very first ',' in "one,two,three,four" β the one right after one. she does NOT keep looking for more commas. first one wins. no cap. π₯
π RETURN VALUE π
Returns a pointer to the first occurrence of c in s, or NULL if no match was found. so if your character is literally nowhere in the string, you get NULL back and you have to deal with that emotionally. π
lowkey important caveat bestie: Note that ifcisNULL, this will return a pointer to the end of the string. not the start, not a crash, the end. she's quirky like that. know it before it jumpscares you. π
π SEE ALSO π
the whole friend group, go say hi:
okay that's the page!! Allegro, version 4.4.3, and this whole thing lives at ustrchr(3) in the manual. mwah, go point at some characters, you're doing amazing sweetie ππ¦β¨ππΈ
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms