关于delete
请看代码:
#include "stdafx.h"
#include <iostream>
using namespace std;
const int m=5;
void main()
{
char re[m];
cin.getline(re,m,'#');
puts(re);
delete []re;
system("pause");
}
我在控制台输入的是:wangfeng
结果:wang
Debug Assertion failed
Expression:_BLOCK_TYPE_IS_VALID(pHead_>nBlockUse)
For information on how your program can cause an assertion failure,see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
..........
我的delete 哪里用错了,请指教啊,新手上路~~
#include "stdafx.h"
#include <iostream>
using namespace std;
const int m=5;
void main()
{
char re[m];
cin.getline(re,m,'#');
puts(re);
delete []re;
system("pause");
}
我在控制台输入的是:wangfeng
结果:wang
Debug Assertion failed
Expression:_BLOCK_TYPE_IS_VALID(pHead_>nBlockUse)
For information on how your program can cause an assertion failure,see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
..........
我的delete 哪里用错了,请指教啊,新手上路~~
...全文
相关推荐
MySQL DELETE 语句
MySQL DELETE 语句是用于从数据库中删除特定记录的关键命令,尤其在进行数据维护和管理时非常实用。本文将详细讲解 DELETE 语句的用法、语法以及如何在命令行和 PHP 脚本中执行它。
delete 和 delete [] 的真正区别
来源:cbNotes链接:http://blog.csdn.net/cbnotes/article/details/38900799c++ 中对new 申请的内存的释放方式有 delet...
C++中delete和delete[]的区别
例如: ```cpp T* p = new T(); // 使用后... delete p; ``` `delete p;`会调用`T`类的析构函数并释放`p`指向的对象所占用的内存。2.
Vue中 axios delete请求参数操作
“Vue中axios delete请求参数操作”在Vue.js应用程序中,axios是一个常用的库,用于发起HTTP请求。本文主要讨论了在使用axios进行DELETE请求时如何传递参数的问题。V
delete的用法
在实际编程过程中,我们应遵循“new与delete、new[]与delete[]”的匹配原则,并注意及时释放不再使用的内存。


