初用VC不知道怎么回事来帮看看
我建一个C++ soure file文件输入以下代码
:
#include <iostream.h>
int main()
{
int *p = new int[2];
for(int a = 0;a < 3;a++)
{
p[a] = a + 1;
}
int *b = new int;
b = &p[1];
cout<<*b<<endl;
*b = NULL;
for(int i = 0;i < 3;i++)
{
p[i] = NULL;
}
delete b;
delete [] p;
return 0;
}
文件名是dsdsd.ccp
编译没有出现如何错误和警告。但是运行的时候出现了错误提示框:
debug Assertion Failed!
program:F\123456\Debug\dsdsd.exe
File:dbgdel.ccp
line:47
Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
For information on how your program can cause an assertion failure, see the Visual C++ documention on assertion.
(press Retry to debug the application)
不知道哪里错了。。。。。。哪位前辈帮我改下。。