单选题 C语言
题号 #143578

根据下列,回答题以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下划线处号码对应的一组选若中选择出正确的选项。#include  
stuct node 
{ char data; struct node *next;};CreatList(char *s)
 { struct node *h,*p,*q);
 h=(struct node *) malloc(sizeof(struct node));
 p=q=h;
 while(*s!='\0')
 { p=(struct node *) malloc(sizeof(struct node));
 p->data= (49) ;
 q->next=p;
 q= (50) ;
 s++;
 }
 p->next='\0';
 return h;
 }
 main()
 { char str[]="link list";
 struct node *head;
 head=CreatList(str);
 ...
 }

进入在线模考

参考答案

C

答案解析

暂无解析

你可能感兴趣的试题

A.*s   
B.s   
C.*s++   
D.(*s)++
A.p->next  
B.p  
C.s  
D.s->next
找试题 · 找答案 · 找资料 在线模考