为什么链表能输入但没有输出

#include<stdio.h>
#include<malloc.h>
typedef struct Polynode
{
	int coef;
	int exf;
	struct Polynode *next;}*Polylist;
void Init(Polylist *l)
{
	*l=(Polylist)malloc(sizeof(Polynode));
	(*l)->next=NULL;}
void Creat(Polylist l)
{
	Polynode *r,*s;
	r=l;
	int c,e;
	scanf("%d%d",&c,&e);
	while(c!=0)
	{
		s=(Polynode*)malloc(sizeof(Polynode));
		s->coef=c;s->exf=e;
		s->next=r;
		r=s;
		scanf("%d%d",&c,&e);}
	r->next=NULL;
}
void Printf(Polylist l)
{
	Polynode *p=l->next;
	while(p!=NULL)
	{
		printf("%d %d\n",p->coef,p->exf);
		p=p->next;}
}
int main()
{
	Polylist l;
	Init(&l);
	Creat(l);
	Printf(l);
	return 0;
}

 

就改了一下你的create函数

#include<stdio.h>
#include<malloc.h>
typedef struct Polynode
{
	int coef;
	int exf;
	struct Polynode *next;
}*Polylist;

void Init(Polylist *l)
{
	*l =(Polylist)malloc(sizeof(Polynode));
	(*l)->next = NULL;
}

void Creat(Polylist l)
{
	Polynode *r,*s;
	r = l;
	int c,e;
	scanf("%d%d",&c,&e);
	while(c != 0)
	{
		s = (Polynode*)malloc(sizeof(Polynode));
		s->coef = c;
		s->exf = e;
		s->next = NULL;
		r->next = s;
		r = s;
		scanf("%d%d",&c,&e);
	}
}

void Printf(Polylist l)
{
	Polynode *p = l->next;
	while(p != NULL)
	{
		printf("%d %d\n", p->coef, p->exf);
		p = p->next;}
}
int main()
{
	Polylist l;
	Init(&l);
	Creat(l);
	Printf(l);
	return 0;
}

 

你是想循环链表还是头插法链表或者尾插法链表?