Console application has triggered a breakpoint.
So I have this 2D char array of pointers which I'm also passing onto other functions but when I try to delete the array I get a breakpoint error. I'm guessing some functions are not properly saving the data behind the pointer.
void toevoegenL()
{
int keuze;
int index = 0;
int indey = 2;
char** text;
text = new char *[20];
for (int i = 0; i <20; i++)
text[i] = new char[10];
fillspacearray(text);
leverancier leverancier1;
leverancier1.levID = instellenL();
try
{
invoerschermL();
gotoxy(22, 5); std::cout << leverancier1.levID;
texteditor(22, 6, 4,text);
cout << text[2][3];
chararray_to_leverancier(leverancier1, text);
wegschrijvenL(leverancier1);
leverancier1.levID++;
invoerschermL();
gotoxy(22, 5); std::cout << leverancier1.levID;
updatenL(leverancier1.levID);
}
catch (const std::exception& e)
{
cout << "er is een fout gebeurt, u kunt opnieuw proberen"<<endl;
system("Pause");
invoerschermL();
gotoxy(22, 5); std::cout << leverancier1.levID;
}
for (int i = 0; i <20; i++)
delete[] text[i];
delete[] text;
}
this is the piece of code where the breakpoint happens.
delete[] text[i];
this line in particular.
I'm also not sure if I'm passing the arrays properly to the other functions.
like this:
void print2DArray(char** A, int width, int height)
or like this:
void print2DArray(char**& A, int width, int height)