What happens when you have the following code:
void makeItHappen()
{
char* text = \"Hello, world\";
}
Does text
go out of
In the first example the string literal is stored in data segment of your executable.
In the second case you do not have to call delete
(in your example program just terminates) since on program termination the heap is freed anyway for the process.
Note though that there are OS (as I have read) that you have to explicitly release heap even if the program terminates since it will not be cleaned up at termination for you.
Of course programmer is responsible for memory management in C++ and objects you create on heap should be delete
ed once unneeded.