下面函数的功能是将指针t2所指向的线性链表,链接到t1所指向的链表的末端。假定t1所指向的链表非空,要实现此功能则下划线处应该添入的选项是()。struct node{ float x;struct node *next;}; connect(struct node *t1, struct node *t2){ if(t1->next==NULL) t1->next=t2; else connect(______ ,t2); }A.t1.nextB.++t1.nextC.t1->nextD.++t1->next

下面函数的功能是将指针t2所指向的线性链表,链接到t1所指向的链表的末端。假定t1所指向的链表非空,要实现此功能则下划线处应该添入的选项是()。struct node{ float x;struct node *next;}; connect(struct node *t1, struct node *t2){ if(t1->next==NULL) t1->next=t2; else connect(______ ,t2); }

A.t1.next

B.++t1.next

C.t1->next

D.++t1->next


参考答案和解析
t1->next

相关考题:

有以下程序段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 结构变量

函数 main() 的功能是 : 在带头结点的单链表中查找数据域中值最小的结点 . 请填空#include stdio.hstruct node{ int data;struct node *next;};int min(struct node *first)/* 指针 first 为链表头指针 */{ strct node *p; int m;p=first-next; m=p-data;p=p-next;for(;p!=NULL;p= _[20]_______ )if(p-datam) m=p-data;return m;}

●试题三阅读下列函数说明和C代码,将应填入(n)处的字句写在答题纸的对应栏内。【说明】函数diff的功能是:根据两个由整数(都大于-32768)按升序构成的单链表L1和L2(分别由A,B指向)构造一个单链表L3(由*r指向),要求L3中的所有整数都是L1,并且不是L2中的整数,还要求L3中的所有整数都两两不等。【函数】#include<malloC.htypedef struct node{int d;struct node *next}Node;void diff(Node *A,Node *B,Node **r){int lastnum;Node*p;*r=NULL;if(!A)return;while( (1) )if(A-dB-d){lastnum=A-d;p=(Node*)malloc(sizeof(Node));p-d=lastnum;p-next=*r; (2) ;doA=A-next;while( (3) );}else if(A-dB-d)B=B-next;else{(4) ;lastnum=A-d;while (A A-d==lastnum)A=A-next;}while(A){lastnum=A-d;p=(Node*)malloc(sizeof(Node));p-d=lastnum;(5) ;*r=p;while (A A-d==lastnum) A=A-next;}}

有以下程序段 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结构变量

有以下结构体说明和变量定义,如图所示,指针p、q、r分别指向此链表中的三个连续节点。 struct node {int data;struct node*next;}*P,*q,*r; 现要将q所指节点从链表中删除,同时要保持链表的连续,以下不能完成指定操作的语句是( )。A.p->next=q->next;B.p->next=P->next->next;C.p->next=r;D.p=q->next;

以下程序的功能是:建立一个带布头结点的单向链表,并将存储在数组中的字符依次存储到链表的各个结点中,请从与下划线处号码对应的一组选项中选择出正确的选项#include <stdlib.h>struct node{char data; struct node *next;};(48) CreatList(char*s),{struct node *h,*p,*q;h=(struct node*)malloc(sizeof(struct node));p=q=h;while(*s!="\0"){ p=(struct node*)malloc(sizeof(struct node));p->data= (49) ;q->next=p;q= (50) ;s++;}p->next="\0";return h;}main(){ char str[]="link list";struct node*head;head=CreatList(str);…}(1)A.char*B.struct nodeC.struct node*D.char

有以下结构体说明和变量的定义,且指针p指向变量a,指针q指向变量b。则不能把节点b连接到节点a 之后的语句是struct node{ char data;struct node*next;}a,b,*p= a,*q=b;A.a. next=q;B.p. next= b;C.p-next=b;D.(*p).next=q;

下面函数的功能是将指针t2所指向的线性链表,链接到t1所指向的链表的末端。假定t1所指向的链表非空struct node{ float x;struct node *next;};connect(struct node *t1, struct node *t2){ if(t1-next==NULL)t1-next=t2;else connect(______ ,t2); }要实现此功能则应该添入的选项是A.t1.nextB.++t1.nextC.t1-nextD.++t1-next

阅读下列函数说明和C代码,将应填入(n)处的字句写在对应栏内。【说明】函数diff的功能是:根据两个由整数(都大于-32768)按升序构成的单链表L1和L2(分别由A,B指向)构造一个单链表L3(由*r指向),要求13中的所有整数都是L1,并且不是 L2中的整数,还要求L3中的所有整数都两两不等。【函数】include < malloc. h >typedef struct node {int d;struct node * next} Node;void diff(Node *A,Node * B,Node * * r){int lastnum;Node * p;*r = NULL;if( ! A) return;while((1))if(A->d < B ->d){lastnum =A -> d;p= ( Node * ) malloc( sizeof(Node) );p->d = lastnum;p->next= *r;(2);doA = A -> next;while((3));}else if(A->d > B->d)B=B- >next;else {(4);lastnum=A -> d;while ( A A->d = = lastnum) A=A-> next;}while(A){lastnum=A->d;p=( Node * ) malloc( sizeof(Node) );p-> d = lastnum;(5);*r=p;while (A A->d = = lastnum) A=A->next;}}

函数min()的功能是:在带头结点的单链表中查找数据域中值最小的结点。请填空includestruc 函数min()的功能是:在带头结点的单链表中查找数据域中值最小的结点。请填空include <stdio.h>struct node{ int data;struct node *next;};int min(struct node *first)/*指针first为链表头指针*/{ struct node *p; int m;p=first->next; re=p->data; p=p->next;for( ;p!=NULL;p=【 】)if(p->data<m ) re=p->data;return m;}

以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下划线处号码对应的一组选若中选择出正确的选项。#include stuct node{ char data; struct node *next;}; (48) CreatLis(char *s){ struct node *h,*p,*q); h=(struct node *)malloc(sizeof(struct node)); p=q=h; while(*s!='\0') { p=(struct node *)malloc(sizeof(struct node)); p-data= (49) ; q-next=p; q= (50) ; s++; } p-next='\0'; return h;}main(){ char str[]="link list"; struct node *head; head=CreatLis(str); ...}A.char *B.struct nodeC.struct node*D.char

有以下程序: 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(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.3B.4C.5D.6

有以下程序 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(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.3B.4C.5D.6

链表题:一个链表的结点结构struct Node{int data ;Node *next ;};typedef struct Node Node ;(1)已知链表的头结点head,写一个函数把这个链表逆序( Intel)

有以下结构体说明和变量定义,如图所示,指针p、q、r分别指向此链表中的3个连续结点。struct node { int data;struct node *next;} *p,*q,*r;现要将q所指结点从链表中删除,同时要保持链表的连续,以下不能完成指定操作的语句是A.p->next=q->next;B.p-next=p->next->next;C.p->next=r;D.p=q->enxt;

有以下结构体说明和变量的定义,且指针p指向变量a,指针q指向变量b,则不能把节点b连接到节点a之后的语句是( )。 struct node { char data; struct node *next; }a,b, *p=a,*q=b;A.a.next=q;B.p.next=b;C.p->next=bD.(*p).next=q;

有以下程序: 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(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.10B.20C.30D.40

以下程序中函数fun的功能是:构成—个如图所示的带头结点的单向链表,在结点的数据域中放入了具有两个字符的字符串。函数disp的功能是显示输出该单向链表中所有结点中的字符串。请填空完成函数disp。include<stdio.h>typedef struct node /*链表结点结构*/{ char sub[3];struct node *next;}Node;Node fun(char s) /* 建立链表*/{ ...... }void disp(Node *h){ Node *p;p=h->next;while([ ]){printf("%s\n",p->sub);p=[ ];}}main(){ Node *hd;hd=fun(); disp(hd);printf("\n");}

有以下结构说明和变量定义,指针p、q、r分别指向链表中的3个连续结点。 struct node { int data;struct node*next;)*p,*q,*r; 现要将q所指结点从链表中删除,同时要保持链表的连续,以下不能按要求完成操作的语句是( )。A.p-next=q-next;B.P-next=P-next-next;C.p-next=r;D.p=q-next;

下面正确定义了仅包含一个数据成员info的单链表的结点类型。struct node { int info;struct node next;} () 此题为判断题(对,错)。

有以下程序 include struct NODE {int num;struct NODE*next;} main() {struct NODE 有以下程序#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.10B.20C.30D.40

以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转存到链表的各个结点中,请填空。 #include <stdlib.h> stuct node { char data; struet node * next; }; stntct node * CreatList(char * s) { struet node *h,*p,*q; h = (struct node * ) malloc(sizeof(struct node) ); p=q=h; while( * s! ='\0') { p = (struct node *) malloc ( sizeof(struct node) ); p - > data = ( ) q- >next=p; q=p; a++; p- > next ='\0'; return h; } main( ) { char str[ ]= "link list"; struet node * head; head = CreatList(str);A.*sB.sC.*s++D.(*s)++

有以下结构体说明和变量的定义,且如图14-4所示的指针p指向变量a,指针q指向变量b。则不能把结点b连接到结点a之后的语句是______。struct node { char data; struct node * next; }a,b,*p=a,*q=b:A.a.next=q;B.p.next=b;C.p->next=b;D.(*p).next=q;

有以下程序 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.3B.4C.5D.6

有以下程序: include struct NODE{int nurn;struct NODE *next; }; main() { struct 有以下程序:#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.3B.4C.5D.6

下面程序的功能是建立一个有 3 个 结 点的单向循环链表,然后求各个 结 点数值域 data 中数据的和。请填空。include stdio.hinclude stdlib.hstruct NODE{ int data;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-data=100; q-data=200; r-data=200;p- next =q; q- next =r; r- next =p;sum=p-data+p-next-data+r-next-next 【 19 】 ;printf("%d\n",sum);}

填空题设线性链表的存储结构如下: struct node {ELEMTP data; /*数据域*/ struct node *next; /*指针域*/ } 试完成下列在链表中值为x的结点前插入一个值为y的新结点。如果x值不存在,则把新结点插在表尾的算法。 void inserty(struct node *head,ELEMTP x,ELEMTP y) {s=(struct node *)malloc(sizeof(struct node)); (); if(){s-nexr=head;head=s;} else { q=head;p=q-next; while(p-dqta!=xp-next!=NULL){q=p;()} if(p-data= = x){q-next=s;s-next=p;} else{p-next=s;s-next=NULL;} } }

填空题设线性链表的存储结构如下: struct node {ELEMTP data; /*数据域*/ struct node *next; /*指针域*/ } 试完成下列建立单链表的算法。 creat() {char var; head=(struct node *)malloc(sizeof(struct node)); head-next= () ; while((var=getchar())!=‘/n’){ ptr=( struct node *)malloc(sizeof(struct node)); ptr-data= var ;ptr-next=head-next; head-next= ptr ; } }