#include<stdlib.h>
#include<string.h>
#define NEW (struct node *)malloc(sizeof(struct node))
struct node
{char name[20],tel[9];
struct node *next;
};
struct node *create()
{struct node *h,*p;
char name[20];
h=NULL;
gets(name);
while(strlen(name)!=0)
{p=NEW;
if(p==NULL)exit(0);
strcpy(p->name,name);
gets(p->tel);p->next=NULL;
if(h=NULL)h=p;
else q->next=p;
q=p;
gets(name);
}return h;
}
main()
{struct node *head;
head=create();
}
如果我要把名单输出 该怎么改呢?