I'm confused once again.
I thought we needed to allocate memory before assigning a value to a char*
and also that we needed to use functions like strcpy() to copy something into it.
Then how come this works and does not crash?
Code:#include <iostream>
using namespace std;
int main()
{
char * buf;
buf = "Hello";
cout << buf << endl;
buf = "World!!!!!!!!";
cout << buf << endl;
return 0;
}