#include <stdio.h>
#include <malloc.h>
#include <string.h>
struct student
{
int date ;
struct student *next ;
};
struct student *chushi ()
{
struct student *head =malloc (sizeof (struct student));
head->date=0;
head->next=NULL;
struct student *wei=head;
int date1=0;
while (1)
{
printf ("输入:\n");
scanf ("%d",&date1);
if (date1==0)
break;
struct student *newnode=malloc (sizeof (struct student));
newnode->date=date1;
newnode->next=NULL;
wei->next=newnode;
wei=newnode;
}
return head;
}
void bianli(struct student *head)
{
if ( NULL==head)
{
return;
}
struct student *cwnb=head->next;
while (cwnb!=NULL)
{
printf ("%d ",cwnb->date);
cwnb=cwnb->next;
}
}
int main ()
{
struct student *head=chushi ();
bianli (head);
}