I am still confused about how object create by new being destroyed
consider the following example:
class C{...};
char* void test(){
char *a = new char[100];
char *b = new char[100];
char *c = new C;
return a;
}
void test2(char* a){
delete []a;
}
main{
char* a= test();
test2(a);
}
what's the lifetime of a,b,c?
Is there any difference between life time after newing a build-in type and a class object?
Thanks in advance
They would all die when the function is done.