char* pArray = nullptr;
{
char buffer[64];
sprintf_s(buffer,"Time: 123456");
pArray = buffer;
}
cout<<pArray<<endl;
"Time: 123456" is displayed even though the buffer has been deallocated back to the stack. What is going on here? Is this safe? Not safe?
undefined behavior.