Could you please tell me what’s wrong with that c++ file?
I want to create an array of TPads and then deallocate them.
[code]#include <TCanvas.h>
#include <TPad.h>
int main(int argc, char* argv[]) {
TCanvas *c_tot = new TCanvas(“bih”,“boh”, 10, 10, 700, 500);
TPad **arr_overlay = new TPad *[2];
arr_overlay[0] = new TPad("overlay0","",0,0,1,1);
arr_overlay[0]->cd();
arr_overlay[1] = new TPad("overlay1","",0,0,1,1);
arr_overlay[1]->cd();
delete arr_overlay[0];
delete arr_overlay[1];
delete[] arr_overlay;
delete c_tot;
return 0;
}[/code]
the wrong part seems to be
delete arr_overlay[0];
delete arr_overlay[1];
caused by
but I can’t figure out the reason why.
The program starts but it crashes during execution.
Thank you!