Original Post
Forgive me if this is beneath the people on this forum, but I've been having a problem with a certain variable. My program has an "update" and "render" function, and in the "update" function I set a const char pointer to some text. But as soon as the function exits, the pointer starts pointing to jibberish. The pointer belongs to an object that doesn't get deleted or anything, so I assumed the pointer and whatever it's pointing to would be safe (that is, wouldn't get deleted once the function finished).
In case it was a matter of the char getting out of scope, I tried creating the char on the heap (using the new keyword), but the same thing happened.
The problem seems to be that the program is deciding my char is out of scope, and deleting it, even though it's not, and there's a pointer pointing to it.
Have I made some mistake?
In case it was a matter of the char getting out of scope, I tried creating the char on the heap (using the new keyword), but the same thing happened.
The problem seems to be that the program is deciding my char is out of scope, and deleting it, even though it's not, and there's a pointer pointing to it.
Have I made some mistake?