delete有关问题

delete问题C/C++ code#include stdafx.h#include iostreamusing namespace stdint _tmain(int argc,

delete问题

C/C++ code
#include "stdafx.h"#include <iostream>using namespace std;int _tmain(int argc, _TCHAR* argv[]){    char *p=new char[30];    p="I love you";    cout<<p<<endl;    delete[] p;  //此处出错;    p=NULL;    return 0;}

问题:为什么会报错?请高手解释原因!

[解决办法]
p="I love you";

改成
char *str ="I love you";

strcpy(p, str);
或者
memcpy