在以下定义的结构体数据类型中,能够用来定义链表结点的是
A: structnode{charname[10];char*next;};
B: structnode{charname[10];intnext;};
C: structnode{charname[10];structnode*next;};
D: structnode{charname[10];char*node;};
A: structnode{charname[10];char*next;};
B: structnode{charname[10];intnext;};
C: structnode{charname[10];structnode*next;};
D: structnode{charname[10];char*node;};
举一反三
- 在以下定义的结构体数据类型中,能够用来定义链表结点的是________。(第8章结构体程序设计) A: structnode{charname[10];char*next;}; B: structnode{charname[10];intnext;}; C: structnode{charname[10];structnode*next;}; D: structnode{charname[10];char*node;};
- 中国大学MOOC: 以下程序执行后的输出结果是#include<stdio.h>#include<stdlib.h>structNODE{intnum;structNODE*next;};intmain(){structNODE*p,*q,*r;intsum=0;p=(structNODE*)malloc(sizeof(structNODE));q=(structNODE*)malloc(sizeof(structNODE));r=(structNODE*)malloc(sizeof(structNODE));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);return0;}
- 以下结构体的定义语句中,正确的是() A: structstudent{intnum;charname[10];intage;};stu; B: struct{intnum;charname[10];intage;}student;structstudentstu; C: structstudent{intnum;charname[10];intage;}stu; D: structstudent{intnum;charname[10];intage;};studentstu;
- 有以下结构体说明和变量的定义,且指针p指向结点a,指针q指向结点b。则把结点b连接到结点a之后的语句是()。structnode{intdata;structnode*next;}structnodea,b,*p=a,*q=b;
- 向建立好的单向链表中的结点pr后插入一个新结点p,且所有结点都已具有如下形式的结构定义:structnode{intdata;structnode*next;}*p,*pr,*head;则操作正确的是A.p->next=pr->next;pr->next=p;B.structnode*pTemp;pTemp=pr->next;pr->next=p;p->next=pTemp;C.pr->next=p;D.p->next=pr->next;pr=p;E.pr->next=p;p->next=pr->next;