我正在char
用一些随机值初始化一个指针,当我试图删除它时,我无法删除。这是为什么?
这是我正在做的事情:
int main()
{
char *s = new char[50]; /*
* I know there is no reason for
* using new if initializing, but
* in order to use delete we need
* to allocate using new.
*/
s = "Harry";
delete s;
return 0;
}