C语言 关于链表的一个程序(请高手帮忙!)

输入学生信息,建立一个链表1储存学生信息,并将链表1中成绩在1400以上的节点从链表1中删去,
然后新建一个节点插入到链表2中(只改变链表节点的指针域)程序结束后释放所有节点占据的空间。
以下是我写的程序中建立链表1的部分,编译出好多问题,可是我不知道错在哪里啊,请牛人指教!
#include<stdio.h>
#include<stdlib.h>
struct student{
char name[20];
char num[20];
int grade;
struct student *Nextptr;
};

typedef struct student Stu;
typedef Stu * St;

main()
{
St headptr1=NULL;
St headptr2=NULL;
headptr1=creat();
headptr2=find(&headptr1);
print(headptr2);
destory(headptr1,headptr2);
system("pause");
}

St creat()//建立链表1
{
St headptr1=NULL,last1=NULL,current1=NULL;

printf("Please input the information of the students:\n");
fflush(stdin);
gets(current1->name);
fflush(stdin);
gets(current1->num);
scanf("%d",¤t1->grade);
while(strcmp(current1->name,"#####")!=0)
{
current1=(St) malloc(sizeof(current1));

if(headptr1=NULL)
{
headptr1=current1;
last1=current1;
}
else
{
last1->Nextptr=current1;
last1=current1;
}

fflush(stdin);
gets(current1->name);
fflush(stdin);
gets(current1->num);
scanf("%d",¤t1->grade);
}
current1->Nextptr=NULL;
return headptr1;
}

//修改完了。。。。
#include<stdio.h>
#include <string.h>
#include<stdlib.h>
struct student{
char name[20];
char num[20];
int grade;
struct student *Nextptr;
};

typedef struct student Stu;
typedef Stu * St;
St creat();

main()
{
St headptr1=NULL;
St headptr2=NULL;
headptr1=creat();
//headptr2=find(&headptr1);
//print(headptr2);
//destory(headptr1,headptr2);
system("pause");
}

St creat()//建立链表1
{
St headptr1=NULL,last1=NULL,current1=NULL;

printf("Please input the information of the students:\n");
// fflush(stdin);
current1=(St) malloc(sizeof(current1));
gets(current1->name);
// fflush(stdin);
gets(current1->num);
scanf("%d",¤t1->grade);
while(strcmp(current1->name,"#####")!=0)
{

if(headptr1==NULL)
{
headptr1=current1;
last1=current1;
}
else
{
last1->Nextptr=current1;
last1=current1;
}
current1=(St) malloc(sizeof(current1));
fflush(stdin);
gets(current1->name);
fflush(stdin);
gets(current1->num);
scanf("%d",¤t1->grade);
}
current1->Nextptr=NULL;
return headptr1;
}
温馨提示:答案为网友推荐,仅供参考
相似回答