双向链表建立出错……高手指点一下
程序代码:struct Node
{
int Data;
struct Node *prior;
struct Node *next;
}Node,*Linklist;
Linklist create(Linklist p)
{ Linklist head,p,q;
int x;
head =(Node *)malloc(sizeof(Node));
head->prior = NULL;
head->next = NULL;
q=head;
scanf("%d",&x);
while(x!=0)
{
p=(Node *)malloc(sizeof(Node));
p->Data=x;
p->prior=q;
p->next=NULL;
q->next=p;
q=p;
scanf("%d",&x);
}
q->next=NULL;
return head;
}










。。。。