指针赋值为什么老出现Access violation?
以下是代码
struct MyPoint
{
float x,y,z;
};
struct PNode
{
MyPoint p1,p2,p3,p4;
float R,G,B;
PNode *next;
};
class MyList
{
public:
MyList();
virtual ~MyList();
void AddList(MyPoint p1,MyPoint p2,MyPoint p3,MyPoint p4,float R,float G,float B);
PNode* GetNext();
void ReSetCurrent();
public:
PNode *first;
PNode *current;
};
void MyList::AddList(MyPoint p1,MyPoint p2,MyPoint p3,MyPoint p4,float R,float G,float B)
{
PNode *p,*q;
p=new PNode;
q=first;
while(q->next!=NULL)
q=q->next;
p->p1=p1;
p->p2=p2;
p->p3=p3;
p->p4=p4;
p->R=R;
p->G=G;
p->B=B;
p->next=NULL;
q->next=p;
}
在调用AddList的时候粗体字处老出现access violation 0xc0000005,为什么啊,求救!