I have a question concerning what will happen to a string when I do like this:
Code:
int main()
{
char* text;
text = "hello world";
text = "this is a string";
return 0;
}
Does the string "hello world" remain in memory? And if it does, is it supposed to be considered a memory leak even though malloc is not involved?
The reason I need to know this is because I want to try writing my own String class in c++, but since this is also a C question I'm posting it here.
I'll be truly thankfull for any help!