[单选题]

有以下程序 inGlude struct NODE { int num; struct NODE *next; } main() {struct N

有以下程序

#inGlude<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=(stnlct 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

参考答案与解析:

相关试题

有以下程序 #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; st

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

  • 查看答案
  • 有以下程序段: typedef struct NODE {int num; st

    [单选题]有以下程序段: typedef struct NODE {int num; struct NODE *next; }OLD; 以下叙述中正确的是 ______。A.以上的说明形式非法B.NODE是一个结构体类型C.OLD是一一个结构体类型D.OLD是一个结构体变量

  • 查看答案
  • 有以下程序段typedef struct NODE{int num;struct

    [单选题]有以下程序段 typedef struct NODE {int num; struct NODE *next; }OLD; 以下叙述中正确的是A.以上的说朗形式非法B.NODE是一个结构体类型C.OLD是一个结构体类型D.OLD是一个结构体变量

  • 查看答案
  • 有以下程序: #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

  • 查看答案
  • 有以下程序 #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)

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

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

  • 查看答案
  • 有下列程序段:typedef struct NODE{int num;struc

    [单选题]有下列程序段: typedef struct NODE {int num;struct NODE*next; }OLD; 下列叙述中正确的是( )。A.以上的说明形式非法B.NODE是一个结构体类型C.OLD是一个结构体类型D.OLD是一个结构体变量

  • 查看答案
  • 有以下程序段typedef struct node { int data; st

    [单选题]有以下程序段typedef struct node { int data; struct node *next; } *NODE;NODE p;以下叙述正确的是A.)p 是指向 struct node 结构变量的指针的指针B.)NODE p ;语句出错C.)p 是指向 struct node 结构变量的指针D.)p 是 struct node 结构变量

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