单项选择题
以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转存到链表的各个结点中,请填空。
#include <stdlib.h>
stuct node
char data; struet node * next; ;
stntct node * CreatList(char * s)
struet 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 = ( )
q- >next=p;
q=p;
a++;
p- > next =’\0’;
return h;
main( )
char str[ ]= "link list";
struet node * head;
head = CreatList(str);
A.*s
B.s
C.*s++
D.(*s)++
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有以下程序: #include <stdio.h> main ( ) int i; for(i =0;i <3 ;i ++ ) switch (i) case 0: printf( % d ,i); case 2: printf( % d , i); default: printf( % d , i);程序运行后的输出结果是( )。
A.022111
B.021021
C.000122
D.012
点击查看答案&解析
单项选择题
有以下程序:#include <stdio.h> main( ) int a=7,b=8,* p,*q, *r; p=&a;q=&b; r=p; p=q;q=r; printf( % d,% d,% d,% d n , * p, * q.a,b);程序运行后的输出结果是( )。
A.8,7,8,7
B.7,8,7,8
C.8,7,7,8
D.7,8,8,7
点击查看答案&解析
相关试题
以下程序的功能是:建立一个带有头结点的单...