Okay the previous question was answered clearly, but i found out another problem.
What if i do:
char *test(int ran){
char *ret = new char[ran];
// process...
return ret;
}
And then run it:
for(int i = 0; i < 100000000; i++){
string str = test(rand()%10000000+10000000);
// process...
// no need to delete str anymore? string destructor does it for me here?
}
So after converting the char* to string, i dont have to worry about the deleting anymore?
Edit: As answered, i have to delete[] each new[] call, but on my case its not possible since the pointer got lost, so the question is: how do i convert char to string properly?