全局变量及函数提前说明:
---------------------------------
#include
#include
typedefstructliuyu{intdata;structliuyu*link;}test;
liuyu*p,*q,*r,*head;
intm=sizeof(test);
voidmain()
{inti;
head=(test*)malloc(m);
p=head;i=0;
while(i!=-9999)
{printf("/ninputaninteger[stopby’-9999’]:");
scanf("%d",&i);
p->data=i;
p->link=(test*)malloc(m);
q=p;
p=p->link;
}
q->link=NULL;
p=head;i=0;
while(p->link!=NULL)
{printf("%d",p->datA.;
p=p->link;
i++;
}
printf("/nnodenumber=%d/n",i-1);
}