heyo community!
got a small problem here.
i defined an array of char*
Code:
class CGameText
{
public:
CGameText(void);
~CGameText(void);
....
char* getCowText(char* cCowName, int nRow);
private:
...
char* cowText[12];
int nRan;
....
};
the function getcowtext should change a field in my char*-array by the use of sprintf but i get an access-violation. this is the code:
Code:
char* CGameText::getCowText(char* cCowName, int nRow)
{
if(nRow == 9)
{
if(cowText[9])
delete(cowText[9]);
sprintf(cowText[9],"the cow's name is... %s",cCowName);
}
return cowText[nRow];
}
why isn't this working?
please help!