何が良くて何が悪い?どのような場合に、メモリ リークを防ぐために delete を呼び出す必要がありますか? また、動作は C と C++ でまったく同じですか? 違いはありますか?
const char* a = "blahblah";
...
delete a;
char b* = new char('a');
...
delete b;
char c[100] = "blahblah";
...
delete c;
char d* = new char[40];
...
delete d;
char e* = new char[40];
...
delete[] e;