You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<stdio.h>#include<raylib.h>intmain(void)
{
constchar*lol;
lol=TextToLower("HELLO_WORLD!");
printf("%s\n", lol); /* prints hello_world */TextToLower("BROTHERS");
printf("%s\n", lol); /* prints "brothers" *//* * Where did i modify `lol`? Nowhere! In fact, it is even constant. * Then what happened? */return0;
}
It's because TextToLower returns a pointer to a statically allocated buffer.
filipencopav
changed the title
[text] const char * gets changed throughout the app unexpectedly.
[text] String returned from TextToLower gets changed unexpectedly throughout the program
Jun 29, 2020
It's because
TextToLower
returns a pointer to a statically allocated buffer.This issue can also arise at any point in any other function that returns a pointer to a static variable.
Solution: Make TextToLower take in input and output parameters.
The text was updated successfully, but these errors were encountered: