有以下程序:
#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
第1题:
有以下程序
#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 (struct NODE));
r=(struct NODE*)malloc(sizeef (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.50
第2题:
有以下程序:
#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
第3题:
有以下程序:
#include <stdlib.h>
struct NODE{
int nurn;
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
第4题:
有以下程序
#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));
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
第5题:
有以下程序
#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(struet 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