编译器报错说p没有被定义 用dev c++
#include<iostream>
#include<stdlib.h>
using namespace std;
class phone
{
public:
int x;
int y;
void printx()
{
cout<<x<<endl;
}
void printy()
{
cout<<y<<endl;
}
};
int main(void)
{
phone coor;
coor.x=10;
coor.y=20;
coor.printx();
coor.printy()
phone *p = new phone();
if(NULL==p)
{
return 0;
}
p->x=100;
p->y=200;
p->printx();
p->printy();
delete *p;
p=NULL;
system("pause");
return 0;
}