欢迎来到牛牛题库网 牛牛题库官网
logo

单项选择题

以下程序的功能是建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请选择合适的选项填入( )。 #include <stdio.h> #include <stdlib.h> struct node { char data; struct node *next; }; struct node* 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=*s; q->next=p; q=______ ; s++; } p->next=NULL; return h; } int main() { char str[]="link list"; struct node *head; head=CreatList(str); return 0; }
A、p->next
B、p
C、s
D、s->next

A.h>
B.h>
点击查看答案&解析
微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题