struct Test * creat()
{
struct Test * head,* p1,* p2,* tmp;
p1=(struct Test *)malloc(sizeof(struct Test));
scanf("%d,%d",&p1->x,&p1->y);
p2=p1;
head=p1;
while(!(p1->x==-1&&p1->y==-1))
{
p1=(struct Test *)malloc(sizeof(struct Test));
scanf("%d,%d",&p1->x,&p1->y);
p2->next=p1;
tmp=p2;
p2=p1;
}
tmp->next=head;//将表头地址赋给表尾节点的next成员不就成环了吗?无需判断
return head;
}
随手写的,有点赘余