c语言编程题,程序功能: 建立一个链表,每个结点包括:学号、姓名、性别、年龄,输入一个学号,如果链表中0
#include "stdio.h"
#include "malloc.h"
#define NULL 0
#define LEN sizeof(struct student)
struct student
{
long num;
char name[10];
char sex[3];
int age;
struct student *next;
};
int n;
struct student *creat(int a)
{
struct student *head;
struct student *p1,*p2;
head=NULL;
while(n=0;n
{p1=(struct student*)malloc(LEN);
scanf("%ld,%s,%s,%d",&p1->num,p1->name,p1->sex,&p1->age);
if(n==0) head=p1;
else p2->next=p1;
p2=p1;
}
p1->next=NULL;
return(head);
}
void main()
{