单项选择题

A.p->next
B.p
C.s
D.s->next
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序:#include <stdlib.h>struct NODE{int num;struct NODE *next;};main( ){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;printf(“%d n”,sum);}执行后的输出结果是( )。
A.3
B.4
C.5
D.6
单项选择题
第48~50题基于以下信息。以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下划线处号码对应的一组选若中选择出正确的选项。#include stuct node{ char data; struct node *next;};(48) 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);...}
A.char *
B.struct node
C.struct node*
D.char
相关试题
  • 有以下程序:void swap1(int c[ ])...
  • 以下程序中函数scmp的功能是返回形参指针s...