2、 指针在free 或delete后必须置为null
3、 指针的长度都为4字节
4、释放内存时,如果是数组指针,必须要释放掉所有的内存,如
char *p=new char[100];
strcpy(p,”hello world”);
delete []p; //注意前面的[]号
p=null;
5、数组指针的内容不能超过数组指针的最大容易。
如:
char *p=new char[5];
strcpy(p,”hello world”); //报错 目标容易不够大
delete []p; //注意前面的[]号
p=null;
十四、关于malloc/free 和new /delete