Crashes are start sometimes?
My function causes the program at start to crash, but only sometimes.
Randomly meaning I'll run it once and it crashes, then the next 2 runs it works fine, then the next 3 crash, then the next one is fine, etc etc.
Note: this function is not close to finished, I just tested to see if it would put the letter values in the array of ints. It works because it couts the values correctly. The unused params now have no effect on it. Also, when i remove the delete before the return it always crashes.
TextFont.cpp
[HIGHLIGHT=D]
#include "Text-Font.h"
#include <iostream>
bool TextClass::WriteText(SDL_Surface* destination, int x, int y, const char* text)
{
int* stringLetterValues = new int;
for(int i = 0; i < (int)strlen(text); i++)
{
stringLetterValues[i] = (int)text[i];
std::cout << stringLetterValues[i] << "\n";
}
delete stringLetterValues;
return true;
}[/Highlight]