SDL_strrev(3)
π SDL_strrev β the glow-up your string asked for π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we take your sad little string and flip it like a mattress. this one's called SDL_strrev and she's iconic, but she comes with a warning label, so stay with me. π
β¨ NAME β¨
SDL_strrev β reverse a string's contents. that's it, that's the whole job. slay. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
char * SDL_strrev(char *str);
π¦ DESCRIPTION π¦
so here's the vibe: this function reverses a null-terminated string, and it does it in-place β meaning it edits the string you handed it, right there, no copy, no new buffer, no nothing. main character energy honestly. β¨
the content of the string gets reversed. the null-terminator character stays exactly where it belongs, at the end of the now-reversed string. it is NOT getting dragged along for the ride, bestie, it's holding the door. π«Ά
WARNING, and I need you to actually read this one: this function reverses the _bytes_ of the string, NOT the codepoints. so if str is a UTF-8 string with Unicode codepoints > 127, this will ruin the string data. like, genuinely ruin it. π you should only use this function on strings that are completely comprised of low ASCII characters. that's the rule. no exceptions. periodt.
π FUNCTION PARAMETERS π
strβ the string to reverse. she's the one getting flipped. π«
β RETURN VALUE β
returns str. that's right, it hands you back the very same pointer you gave it β which, again, is now reversed, because in-place is the whole thing. π₯
π THREAD SAFETY π
it is safe to call this function from any thread. go forth and multithread, you absolute legend. π
π AVAILABILITY π
this function is available since SDL 3.2.0. if you're on anything older, she simply does not exist yet, sorry babe. π
and that's the page!! brought to you by the Simple Directmedia Layer girlies, running SDL 3.4.18 β thanks for reading, go reverse something (that's low ASCII, please, I'm begging π). bye bestie, love u, drink water ππΈβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms