Is this code correct in terms of the memory management?

#include <exception>

struct A {
  void Foo() { throw std::exception(); }

void Test() {
  A *a = new A();
  delete a;
No, because in the Test() function there is a leak of memory, allocated for a.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes