找考题网-背景图
填空题

以下程序建立了一个带有头结点的单向链表,链表结点中的数据通过键盘输入,当输人数据为-1时,表示输入结束(链表头结点的data域不放数据,表空的条件是ph->next=NULL).
# include<stdio.h>
struct list int datd;struct list * next;;
【19】 creatlist( )
struct list * p,*q,*ph;
int a;
ph= (struct list*)malloc(sizeof(struct list));
p=q=ph;
printf("Input an integer number,enter-1 to end:\n");
scanf("%d",&a);
while(a!=-1)
p=(struct list * )malloc(sizeof(struct list));
p->data=a;
q->next=p;
【20】 =p;
scanf("%d",&a);
p->next=’\0’;
return(ph);
main( )
struct list head;
head=creatlist( );

【参考答案】

[19]struct list *
[20] q
热门试题

填空题[17]i+1[18] i

填空题[17]i+1[18] i

单项选择题B