char* buf;
buf=new char(100);
memset(buf,'1',100);
delete [] buf;
编译没问题,运行就报错了。
delete出错
------解决方案--------------------------------------------------------
delete buf;
就可以了
new 出来的不是一个数组
------解决方案--------------------------------------------------------
buf=new char(100);
这里错了
是buf=new char[100];