首页 > 职业考试题库1 > 题目详情
有以下程序 #include struct NODE {int num;stmc
题目内容:
[单选题]有以下程序 include struct NODE {int num;stmct NODE*next;}; main() { struct NODE有以下程序
#include<stdlib.h>
struct NODE
{ int num;stmct NODE*next;};
main()
{ struct NODE*p,*q,*r;
p=(struct NODE*)malloc(sizeof(struct NODE));
q=(struct NODE*)malloc(sizeof(struct NODE));
r=(struct NODE*)malloc(sizeof(struct NODE));
p->num=10;q->num=20;r->num=30;
p->next=q;q->next=r;
printf(“%d/n”,p->num+q->next->num);
}
程序运行后的输出结果是
A.10
B.20
C.30
D.40
有以下程序
#include<stdlib.h>
struct NODE
{ int num;stmct NODE*next;};
main()
{ struct NODE*p,*q,*r;
p=(struct NODE*)malloc(sizeof(struct NODE));
q=(struct NODE*)malloc(sizeof(struct NODE));
r=(struct NODE*)malloc(sizeof(struct NODE));
p->num=10;q->num=20;r->num=30;
p->next=q;q->next=r;
printf(“%d/n”,p->num+q->next->num);
}
程序运行后的输出结果是
A.10
B.20
C.30
D.40
本题链接: