我不知道怎么改,各位大侠帮我!
#include<stdio.h>#include<malloc.h>
struct student
{
int num;
struct student *link;
}stud;
creat(int n)
{
struct student *h,*p;
int i;
if((h=(stud *)malloc(sizeof(stud)))==NULL);
{
printf("not enough memory!");
return(0);
}
h=NULL;
for(i=0;i<=n;i++)
{
p=h;
if((p=(stud *)malloc(sizeof(stud)))==NULL);
{
printf("内存不足!");
return(0);
}
scanf("%d",&p->num);
p->link=h;
h=p;
}
}
void main()
{
struct student *h;
h=(struct student *)creat(4);
}