#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
#define NULL 0
struct student{
char name[20];
int number;
int math;
struct student * next;
};
struct student * creat()
{
struct student *head,*p,*q;
int n;
printf("输入一个1继续输入n=");
scanf("%d",&n);
printf("\nname:\tnumber:\t\tmath:\t\t\n");
while(!n){
p=(struct student*)malloc (sizeof(struct student));
head=p;
q=p;
p=p->next;
q->next=NULL;
scanf("%s",&p->name);
scanf("%d",&p->number);
scanf("%d",&p->math);
}
return(head);
}
void print(struct student *)
{
struct student *head,*p;
head=p;
while(!p->next)
{
printf("name:\tnumber:\tmath\t\n",p->name,p->number,p->math);
p=p->next;
}
}
void main()
{
struct student *head;
head=creat();
print(head);
}