Could someone explain for me what is happening here?
char *string;
string = new char[5];
string = "This is the string";
cout << string << std::endl;
The output contains (This the string) even though I only allocated 5
characters in memory with new.
char *string;
string = new char[5];
string = "This is the string";
cout << string << std::endl;
The output contains (This the string) even though I only allocated 5
characters in memory with new.
Comment