Do I have to delete pointer if program will exit soon?
Like this:
#include "mainwidget.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWidget w;
w.show();
int *a = new int[5];
delete []a;
return a.exec();
}
Do I really have to call delete []a;
or It doesn't matter because after return a.exec();
(main()
funtcion finishes) all pointers will be destroyed automatically?