typedef struct student
{
int data;
struct student*next;
struct student*pre;
}dnode;
dnode*creat()
{
dnode *head, *p, *s;
int x, cycle = 1;
head = (dnode*)malloc(sizeof(dnode));
p = head;
while (cycle)
{
printf("\nplease input the data: ");
scanf_s("%d", &x);
if (x != 0)
{
s = (dnode*)malloc(sizeof(dnode));
s->data = x;
printf("\n %d", s->data);
p->next = s;
s->pre = p;
p = s;
}
else cycle = 0;
}
head = head->next;
head->pre = NULL;
p->next = NULL;
printf("\n yyy %d", head->data);
return head;
}