6-1 采用尾插法创建联系人链表
con* creatList()
{
int n,i;
con* head ,*tail,*p;
head = tail = NULL;
scanf("%d",&n);
for(i=0; i<n; i++)
{
p = (con*)malloc(sizeof(con));
scanf("%d",&p->xh);
scanf("%s",p->name);
scanf("%s",p->tel);
p->next =NULL;
if(head==NULL)
{
head = p;
tail = p;
}
else
{
tail->next = p;
tail = p;
}
}
return head;
}