struct node*p=(struct node*)malloc(sizeof(struct node))

1.动态建立链表：

2.把链表中数据打印出来：

1为顺序建表，逆序建表如下：

3.步骤1和2结合：

p->next=head; head=p;(当head为空时，插入的p为第一个结点）

1.删除表头结点：

q=head; head=head->next; free(q); --free(q)表示释放q的空间

2.删除尾巴结点：

3.删除指定位置结点：

#include<stdio.h>#include<string.h>#include<malloc.h>struct student{  int num;  char name[20];  float score;  struct student* next;};  //建立链表struct student* fun(int n)  //建立n个结点{  struct student* head, * p, * q;  head = NULL;  q = NULL;  int i;  for (i = 0; i < n; i++)  {  p = (struct student*)malloc(sizeof(struct student));    printf("输入学号,分数：");    scanf("%d,%f",& p->num, &p->score);    rewind(stdin);    printf("输入姓名：");    gets(p->name);    p->next = NULL;    if (head == NULL)    {    head = p;    q = p;    }    else    {    q->next = p;    q = p;    }  }  return head;}//  遍历链表void func(struct student* head){  struct student* p;  p = head;  while (p != NULL)  {  printf("输出学号,姓名,分数：%d,%s,%.2f\n", p->num, p->name, p->score);  p = p->next;  }}//结点插入struct student* fun1(struct student* head, struct student* p){  struct student* q1, * q2;  q1 = head;  q2 = NULL;  while (q1 != NULL && q1->score >= p->score)  {  q2 = q1;  q1 = q1->next;  }  if (q2 == NULL)  //表头插入  {  p->next = q1;  head = p;  }  else if (q1 == NULL)  //表尾插入  q2->next = p;  else  //在q1结点前,q2后插入  {  p->next = q1;  q2->next = p;  }  return head;}//结点删除struct student* fun2(struct student* head, int num){  struct student* q1, * q2;  q1 = head;  q2 = NULL;  while (q1 != NULL && q1->num != num)  {  q2 = q1;  q1 = q1->next;  }  if (q2 == NULL)  head = q1->next;  else if (q1 != NULL)  q2->next = q1->next;  free(q1);  return head;}int main(){  struct student* p, * p1, * p2 ,*p3,* q;  q = (struct student*)malloc(sizeof(struct student));  q->num = 103;  printf("输入这个同学的姓名：");  gets(q->name);  q->score = 85;  q->next = NULL;  printf("输入你要输入信息的个数：");  int n=0,n1=0;  scanf("%d", &n);  p = fun(n);  func(p);  printf("打印插入后链表：\n");  p1 = fun1(p,q); //结点插入  func(p1);  printf("输入你要删除同学信息的学号：");  scanf("%d", &n1);  printf("打印删除后链表：\n");  p2 = fun2(p,n1); //删除学号为n1的同学的信息  func(p2);  printf("打印插入后删除的链表：\n");  p3 = fun2(p1, n1);  func(p3);  return 0;}