清华大学C语言教学课件(共16个PPT)第12个教学提纲.pptVIP

  • 12
  • 0
  • 约7.05千字
  • 约 45页
  • 2020-11-19 发布于浙江
  • 举报

清华大学C语言教学课件(共16个PPT)第12个教学提纲.ppt

清华大学C语言教学课件(共16个PPT)第12个;5;// 结构7.c #include stdio.h // 预编译命令 #include malloc.h // 内存空间分配 #define null 0 // 定义空指针常量 #define LEN sizeof(struct numST) // 定义常量,表示结构长度 struct numST // 结构声明 { int num; // 整型数 struct numST *next; // numST结构指针 }; ;// 被调用函数insert(),两个形参分别表示链表和待插入的结点 void insert (struct numST **phead, struct numST *p) { // 函数体开始 struct numST *q,*r; // 定义结构指针q,r if ((*phead)==null) // 第一种情况,链表为空 { *phead = p; // 链表头指向p return; // 完成插入操作,返回 } else // 链表不为空 { // 第二种情况,p结点num值小于链表头结点的num值 if ( (*phead)-num p-num ) { // 将p结点插到链表头部

文档评论(0)

1亿VIP精品文档

相关文档