在带头结点*head的单循环链表中至少有一个结点时,尾结点*p应该满足的条件是 。
A.p->next==NULL
B.p==head->next
C.p == NULL
D.p->next == head
- · 有3位网友选择 C,占比33.33%
- · 有3位网友选择 B,占比33.33%
- · 有2位网友选择 A,占比22.22%
- · 有1位网友选择 D,占比11.11%
A.p->next==NULL
B.p==head->next
C.p == NULL
D.p->next == head
A、head= =NULL
B、head->next= =NULL
C、head!=NULL
D、head->next= =head
以下程序建立一个带有头结点的单向链表,链表结点中的数据通过键盘输入,当输入数据为-1时,表示输入结束(键表头结点的data域不放数据,表空的条件是ph->next==NULL),请填空。 include<stdio.h> struct list{ int data;struct list*next;}; struct list*creatlist() { struct list*p,*q,*ph;int a;ph=(struct list*)malloc(sizeof(struct list)); p=q=ph;printf("Input an integer number;entre-1 to end:\n"); scanf("%d",&a); while(a!=-1) { p=(struct list*)malloc(sizeof(struct list)); 【 】=a;q->next=p;【 】=p;scanf("%d",&a);} p->next=\0;return(ph);} main() {struct list * head;head=creatlist();}
A、p->next=head->next; head->next=p;
B、p->next=head->next; head=p;
C、p->next=head; head=p;
D、p->next=head; p= head;
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!