A
A
Hi,
consider this:
char* aClass:rintHello()
{
char* ptr = new char[6];
ptr = "Hello";
return ptr;
delete[] ptr;
}
Is it possible to return ptr and then delete[] ptr afterwards. I think the
delete[] ptr statement will not be executed after the return statement. Any
workaround for this?
REgards
ML
consider this:
char* aClass:rintHello()
{
char* ptr = new char[6];
ptr = "Hello";
return ptr;
delete[] ptr;
}
Is it possible to return ptr and then delete[] ptr afterwards. I think the
delete[] ptr statement will not be executed after the return statement. Any
workaround for this?
REgards
ML