指针小问题!
大家帮我看一下程序有什么问题?编译没错,运行就不行了//#include"iostream.h"
void main()
{
int b=1000;
int *p=new int;
p=&b;
delete p;
}
#include"iostream.h"
void main()
{
int b=1000;
int *p=new int;
p=&b;
delete p;
}
在主函数中没有程序运行的东西,如果你在P=&B的下面写上
cout<<*P<<endl;
我在dev-c++中运行没错阿?
为什么啊?