填空题
下面程序中函数creat用于建立一个带头结点的单向链表,新产生的结点总是插在链表的末尾,单向链表的头指针作为函数值返回。将程序补充完整。
#include<stdiao.h>
struct list
char data; struct list * next;;
struct list * creat()
struct list *h,*p,*q; char ch;
h=
【18】
malloc(sizeof(struct list));
p=q=h;ch=getchar();
while(ch!=’’)
p=
【19】
malloc(sizeof(struct list));
p->data=ch;q->next=p;q=p;ch=getchar();
p->next=’\0’;
【20】
;
【参考答案】
[18](struct list *)
[19](struct list *)
[20]return(h)
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
下面程序的输出结果是 【12】 。 char b[]= ABCD ; main() char *p=b; for(;*p;p++) printf( %s ,p); printf( n );
点击查看答案
填空题
下列程序的输出结果是 【8】 。 main() int a=1,b=2; a=a+b;b=a-b,a=a-b; printf( %d,%d n ,a,b) ;
点击查看答案
相关试题
以下程序调用随机函数得到N个20以内的整...