2013年计算机二级考试C语言课后习题(第十四章)_第3页

考试站(www.examzz.com)   【考试站:中国教育考试第一门户】   2013年1月17日
 二、填空题

  14.9 为了建立如图所示的存储结构(即每个结点含两个域,date是数据域,next是指向结点的指针域),请填空。

  struct link

  { char data;

  _________;

  } node;

  答案:struct link *next

  14.10 以下MIN函数的功能是:查找带有头结点的单向链表中,结点数据域的最小值作为函数值返回。

  请填空。

  struct node { int data;

  struct node *next;

  };

  int MIN(struct node *first)

  { struct node *p;

  int m;

  p=first->next;

  m=p->data;

  for(p=p->next; p!=\'\\0\'; p=_____)

  if(______) m=p->data;

  return m;

  }

  答案:p->next p->data  14.11 以上函数creat 用来建立一个带头结点的单向链表,新产生的结点总是插在链表的末尾,单向链表

  的头指针作为函数值返回。请填空。

  #include "stdio.h"

  struct list

  { char data;

  struct list *next;

  } ;

  struct list *creat()

  { struct list *h,*p,*q;

  char ch ;

  h=_____malloc(sizeof(____));

  p=q=h;

  ch=getchar();

  while(ch!=\'?\')

  { p=____malloc(sizeof(____));

  p->data=ch;

  q->next=p;

  q=p;

  ch=getchar();

  }

  p->next=\'\\0\';

  ________;

  }

  答案:(struct list *)、 struct list、 (struct list *)、 struct

  list、 return h


首页 1 2 3 尾页

相关文章