For my breakout clone, I need to convert the integers for the score and the level number into arrays of characters so I can display them on the screen with Allegro's textout function. I searched on google for a function to convert, and I found "itoa". So, it seemed to work fine. I converted "level" to "leveltex" and "score" to "scoretex" and displayed them on the screen. But then I noticed something weird was happening. Whenever "score" hit 10,000, it caused "level" to jump to 45. This happens even if there is no command telling "level" to change it's quantity in the entire program. I noticed that if I didn't convert score using itoa, "level" did not jump to 45. So, whenever "score" hits 10,000 and is converted with itoa, "level" jumps to 45. Here is the itoa part of the code:
Code:
void DrawHUD()
{
itoa(level,leveltex,10);
itoa(score,scoretex,10);
textout(buffer,font,"Level:",700,120,makecol(255,255,255));
textout(buffer,font,leveltex,700,130,makecol(255,255,255));
textout(buffer,font,"Score:",700,90,makecol(255,255,255));
textout(buffer,font,"10000",700,100,makecol(255,255,255));
}
Nowhere in the program does it tell level to change. What's going on? Is there another part of the code I should show you guys?