typedef struct node{char name[20];struct node *link;}stud;
C 实现单链表
#include <stdio.h>
#include <malloc.h> /*包含动态内存分配函数的头文件*/
#define N 10 /*N为人数*/
typedef struct node
{char name[20];struct node *link;
}stud;
stud * creat(int n) /*建立单链表的函数,形参n为人数*/
{stud *p,*h,*s; /* *h保存表头结点的指针,*p指向当前结点的前一个结点,*s指向当前结点*/int i; /*计数器*/if((h=(stud *)malloc(sizeof(stud)))==NULL) /*分配空间并检测*/{printf("不能分配内存空间!");exit(0);}h->name[0]='