A-A+
以下程序的功能是:建立一个带有头结点的甲—向链表 并将存储在数组中的字符依次转存到链表的各个
问题详情
以下程序的功能是:建立一个带有头结点的甲—向链表,并将存储在数组中的字符依次转存到链表的各个结点中,请从与下划线处号码对应的一组选项中选择出正确的选项。
#include <stdlib.h>
struct node
{ char data; struct node *next: };
(1) CreatList(char *s)
{
struct node *h,*p,*q;
h = (struct node *)malloc sizeof(struct node));
p=q=h;
while(*s! ="")
{
p = (struct node *)malloc(sizeof (struct node));
p->data = (2) ;
q->next = p;
q - (3) ;
S++;
}
p->next="";
return h;
}
main()
{
char str[]="link list";
struct node *head;
head = CreatList(str);
}
(1)
A.char*
B.struct node
C.struct node*
D.char请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:C