[单选题]

有以下程序

#include

struct NODE

{ int num; struct 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 gtruet NODE {intnum;struc

[单选题]有以下程序 include gtruet NODE {intnum;struct NODE *next;}; main() {struct NODE有以下程序#include <stdlib.h>gtruet NODE{ int num; struct NODE *next; };main(){struct NODE *p,*q,*r;p=(struct NODE*)malloc(sizeof (struct NODE));q=(struct NODE*)malloc(sizeof (struc

  • 查看答案
  • 有以下程序 #include #include typedef struct

    [单选题]有以下程序 include include typedef struct { cha有以下程序 #include <stdio.h> #include <string.h> typedef struct { char name[9]; char sex; float score[2]; } STU; STU f(STU a) { STU b={"Zhao", 'm', 85.0, 90.0}; int i; strcpy(a.name, b.name); a.sex = b.sex;

  • 查看答案
  • 有以下程序 #include main() { struct STU{char

    [单选题]有以下程序 include main() { struct STU{char name[9];char sex;double有以下程序 #include <stdio.h> main() { struct STU{char name[9];char sex;double score[2];}; sturt STU a={"Zhao" ,'m',85.0,90.0},b={"Qian" ,'f,95:0,92.0}; b=a; printf("%s,%c,%2.0f,%2.0f/

  • 查看答案
  • 有以下程序 #include main() { struct STU{char

    [单选题]有以下程序 include main() { struct STU{char name[9];char sex;double有以下程序 #include <stdio.h> main() { struct STU{char name[9];char sex;double score[2];}; sturt STU a={"Zhao" ,'m',85.0,90.0},b={"Qian" ,'f,95:0,92.0}; b=a; printf("%s,%c,%2.0f,%2.0f/

  • 查看答案
  • 有以下程序 #include struct tt { int x; struc

    [单选题]有以下程序 include struct tt { int x; struct tt *y; } *p; s有以下程序 #include <stdio.h> struct tt { int x; struct tt *y; } *p; struct tt a[4]= {20,a+ 1,15,a+2,30,a+3,17,a}; main() { int i; p=a; for(i=1; i<-2; i++) { printf("%d,", p->x ); p=p->y; }A.20,30,B

  • 查看答案
  • 有以下程序: #include struct STU (char name[1

    [单选题]有以下程序: include struct STU (char name[10]; int num; };有以下程序: #include <string.h> struct STU (char name[10]; int num; }; void f(char *name, int num) {struct STU s[2]={{"SunDan",20044}.{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } mai

  • 查看答案
  • 有以下程序: #include struct STU {int num; fl

    [单选题]有以下程序: include struct STU {int num; float TotalScore;有以下程序: #include <strino.h> struct STU {int num; float TotalScore; }; void f(struct STU p) {struct STU s[2]={{20044,550},{20045,537}}; p.num=s[1].num;p.TotalScore=s[1].TotalScore; } main() {struct

  • 查看答案
  • 有以下程序 #include struct NODE{ int num; st

    [单选题]有以下程序 include struct NODE{ int num; struct NODE *next;}; main( )有以下程序#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(struc

  • 查看答案
  • 有以下程序: #include struct NODE {int num;stm

    [单选题]有以下程序: include struct NODE {int num;stmct NODE *next;}; main( ) { str有以下程序:#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(stru

  • 查看答案
  • 有以下程序 #include struct NODE { int num;str

    [单选题]有以下程序 include struct NODE { int num;struct NODE*next;}; main() { struct NO有以下程序#include<stdlib.h>struct NODE{ int num;struct NODE*next;};main(){ struct NODE*p,*q,*r;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE

  • 查看答案