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

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


相关考题:

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

●试题三阅读下列函数说明和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;}}

阅读下列函数说明和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;}}

阅读下列程序说明和C程序,已知其输出为“1 2 3 4 5 6 7 8 9 10”。将应填入(n)处的字句写在对应栏内。[说明]本程序包含的函数及其功能说明如下:(1)函数first_insert()的功能是在已知链表的首表元之前插入一个指定值的表元;(2)函数reverse_copy()的功能是按已知链表复制出一个新链表,但新链表的表元链接顺序与已知链表的表元链接顺序相反;(3)函数Print_link()用来输出链表中各表元的值;(4)函数free_link()用来释放链表全部表元空间。[程序]include <stdio. h >include <malloe. h >typodef struct node {int val;struct node * next;} NODE;void first_insert(NODE * * p,int v){ NODE *q = (NODE *) malloe(sizeof(NODE));q-val = v; q->next = *p; /* 为新表元赋值*/* p =(1); }NODE * reverse_copy( NODE * p){ NODE * u;for(u=NULL; p!=NULL; p=p->next) first_insert((2));return u;}void printlink(NODE * p ){ for(;(3)) prinff("%d\t", p-val);printf(" \n");}void free_link( NODE * p){ NODE * u;while(p! =NULL) { u=p-next;free(p);(4); }void main( ) { NODE * link1 , * link2;int i;link1 = NULL;for(i=1; i<= 10; i+ + )first_insert(linkl, i);link2 = reverse_copy(link1 );(5);free_link( linkl ) ;free_link(link2); }

阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。[说明]下面程序实现十进制向其它进制的转换。[C++程序]include"ioStream.h"include"math.h"includetypedef struct node {int data;node*next;}Node;Class Transform.{DUDlic:void Trans(int d,int i); //d为数字;i为进制void print();private:Node*top;};void Transform.:Trans(int d,int i){int m,n=0;Node*P;while(d>0){(1);d=d/i;p=new Node;if(!n){p->data=m;(2);(3);n++;}else{p->data=m;(4);(5);}}}void Transform.:print(){Node*P;while(top!=NULL){p=top;if(p->data>9)cout<<data+55;elsecout<<data;top=p->next;delete p;}}

Simplify the following Boolean expression!((i ==12) || (j 15))struct Node {int value;Node* next;};1.1 Get the value of the Nth node from last node in the linked list.PARAM HEAD: the first element in the linked list:PARAM n: the number of the node counted reverselyRETURN: the value of the node, or -1 if not existsint GetValue(Node* HEAD, int n){}1.2 Delete a node WITHOUT using the HEAD pointer.PARAM p: A pointer pointed to a node in the middle of the linked list.RETURN: voidvoid Delete(Node* p){}1.3 Insert a new node before p WITHOUT using the HEAD pointerPARAM p: A pointer pointed to a node in the middle of the linked list.PARAM value: new Node valueRETURN: voidvoid Insert(Node* p, int value){}Question 2:Please write a String class with following features:

下列给定程序中,是建立一个带头结点的单向链表,并用随机函数为各结点数据域赋值。函数fun的作用是求出单向链表结点(不包括头结点)数据域中的最大值,并且作为函数值返回。请改正程序指定部位的错误,使它能得到正确结果。[注意] 不要改动main函数,不得增行或删行,也不得更改程序的结构。[试题源程序]include<stdio.h>include<stdlib.h>typedef struct aa{int data;struct aa *next;}NODE;fun(NODE *h){int max=-1;NODE *p;/***********found************/p=h;while(p){if(p->data>max)max=p->data;/************found************/p=h->next;}return max;}outresult(int s, FILE *Pf){fprintf(pf, "\nThe max in link: %d\n", s);}NODE *creatlink(int n, int m){NODE *h, *p, *s, *q;int i, x;h=p=(NODE *)malloc(sizeof(NODE));h->data=9999;for(i=1; i<=n; i++){s=(NODE *)malloc(sizeof(NODE));s->data=rand()%m; s->next=p->next;p->next=s; p=p->next;}p->next=NULL;return h;}outlink(NODE *h, FILE *pf){NODE *p;p=h->next;fprintf(Pf, "\nTHE LIST:\n\n HEAD");while(P){fprintf(pf, "->%d", P->datA); p=p->next;}fprintf(pf, "\n");}main(){NODE *head; int m;head=cteatlink(12,100);outlink(head, stdout);m=fun(head);printf("\nTHE RESULT"\n");outresult(m, stdout);}

下而程序实现十进制向其他进制的转换。[C++程序]include"ioStream.h"include"math.h"include <conio.h>typedef struct node{int data;node *next;}Node;class Transform{public:void Trans(int d,int i); //d为数字;i为进制void print();private:Node *top;};void Transform.:Trans(int d,int i){int m,n=0;Node *P;while(d>0){(1) ;d=d/i;p=new Node;if(!n){P->data=m;(2) j(3) ;n++;}else{p->data=m;(4) ;(5) ;}}}void Transform.:print(){Node *P;while(top!=NULL){p=top;if(P->data>9)cout<<data+55:elsecout<<data;top=p->next;delete P;}}

设链表中的结点是NODE类型的结构体变量,且有NODE*p;为了申请一个新结点,并由p指向该结点,可用以下语句()。Ap=(NODE*)malloc(sizeof(p));Bp=(*NODE)malloc(sizeof(NODE));Cp=(NODE)malloc(sizeof(p));Dp=(NODE*)malloc(sizeof(NODE));