有以下程序: #include<stdio.h> #include<stdlib.h> struct NODE {int num;struct NODE *next; }
有以下程序:
#include <stdio.h>
#include <stdlib.h>
struct NODE
{ int num;
struct NODE *next;
};
main()
{ struet NODE *p,*q,*r;
int sum=0;
p=(struct NODE *) malloc(sizeof(struct NODE));
q=(struct NODE *) malloc(sizeof(struet 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