这是我自己写的带头结点的链表的创建、查找、插入、删除的程序,有注释,有哪里不明白可以留言评论哦
# include <stdio.h>
# include <malloc.h>
# include <string.h>
/*定义结构体*/
typedef struct student
{
char name[20];
int score;
struct student *Next;
}STU,*List;
/*创建接收学生信息*/
int i=0;
const List stuList()
{
List temp,temp1 = NULL;
char names[20];
List pHeader = (List)malloc(sizeof(STU)); //创建头结点
pHeader -> Next = NULL;
while(1)
{
printf("请输入第%d个学生信息(直接回车停止输入学生信息):\n",++i);
printf("\n\t姓名:");
fflush(stdin);
gets(names); //接收字符串
if(!strlen(names))
break;
temp = (STU*) malloc(