#include<stdio.h>#include<stdlib.h>#define len sizeof(stu)typedefstruct student{int num;char name[10];struct student *next;}stu;
stu *creat_link(){
stu *head =NULL,*p,*p1;
p =(stu *)malloc(len);printf("输入学号姓名:\n");scanf("%d%s",&p -> num,p -> name);while(p -> num !=0){if(head ==NULL){
head = p;
p1 = p;
p -> next =NULL;}else{
p1 -> next = p;
p1 = p;}
p =(stu *)malloc(len);printf("输入学号姓名:\n");scanf("%d%s",&p -> num,p -> name);}free(p);return head;}voidprint(stu *head){
stu *p;
p = head;while(p !=NULL){printf("%10d%10s\n",p -> num,p -> name);
p = p -> next;}}intmain(){
stu *head1;
head1 =creat_link();print(head1);return0;}