I think it has to do with memory allocation issues, but there is a destructor there to free the memory of the object t of type A.
#include <stdio.h>
struct A {
int* i;
A() { i = new int[3]; }
~A() { delete i; }
};
int main() {
A t;
}
I think it has to do with memory allocation issues, but there is a destructor there to free the memory of the object t of type A.
#include <stdio.h>
struct A {
int* i;
A() { i = new int[3]; }
~A() { delete i; }
};
int main() {
A t;
}
~A() { delete i; }
should be
~A() { delete []i; }