网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
若有以下定义和语句: struct st {  int n;  struct st*next; }; struct st a[3] = {5,&a[0], 6,&a[1],7,&a[2]}, *p; p = &a[0]; 则值为6的表达式是(提示:运算符->的优先级高于++)(  )。
A

(*p).n++

B

p++->n

C

p->n++

D

(++p)->n


参考答案

参考解析
解析:
定义指向结构体变量的指针p,并将结构体数组首地址赋给p。执行(++p)->n,p指针加一指向数组第二个元素a[1],a[1].n=6,D项正确。A项,(*p).n++,*p为结构体数组第一个元素a[0],a[0].n=5,先取值,表达式为5。B项,p++->n,p指向结构体数组第一个元素a[0],a[0].n=5。C项,p->n++,p指向结构体数组第一个元素a[0],a[0].n=5,由于++是后缀,先取值,所以表达式为5,之后再加一。答案选择D选项。
更多 “单选题若有以下定义和语句: structst {  intn;  structst*next; }; structsta[3]={5,a[0],6,a[1],7,a[2]},*p; p=a[0]; 则值为6的表达式是(提示:运算符-的优先级高于++)(  )。A (*p).n++B p++-nC p-n++D (++p)-n” 相关考题
考题 若有以下说明和语句:sturct st { int n;char *ch;}; struct st a[3]={5, "abc",7, "def",9, "ghk"},*p=a;则值为6的表达式是( )。A)p++-n B)p-n++C)(*p).n++ D)++p-n

考题 下列程序的输出结果是( )。 #include "stdio.h" main() { struct st { int y,x,z;}; union {long i;int j; char k;} un; printf("%d,%d\n",sizeo(struct st),sizeof(un)); }A.6,2B.6,4C.8,4D.8,6

考题 若有下列说明和语句,已知int型数据占2个字节,则下列语句的输出结果是( )。stmct st{ char a[15];int b;double c;};printf("%d",sizeof(struct st));A.15B.8C.25D.2

考题 若有下列说明和语句,则对结构体变量st中成员i的引用方式不正确的是( )。Struct stu{inti;intname;}st,*#p;p=St;A.st.iB.*p.iC.(*p).iD.p->i

考题 以下程序的输出是______。 struct st {int x;int*y; }*p; int dt[4]={10,20,30,40}; struct st aa[4]={50,dt[0],60,dt[1],60,dt[2],60,dt[3]}; main() { p=aa; printf("%d\n",++(p->X)); }A.51B.11C.50D.60

考题 下列程序的输出结果是()。includemain(){struct st{int y,x,z;};union{long i; int j; 下列程序的输出结果是( )。 #include<stdio.h> main() { struct st { int y,x,z; }; union { long i; int j; char k; }un; printf("%d,%d\n",sizeof(struct st),sizeof(un)); }A.6,2B.6,4C.8,4D.8,6

考题 若有以下程序段: struct st {int n; int*m: }; int a=2,b=3,c=5; struct st s[3]=({101,a},{102,c},{103,B)}; main() {struct st*p; p=s; } 则以下表达式中值为5的是( )。A.(*p).mB.*(p+1)->mC.*(p++)->nD.(p++)(*m)

考题 设有以下程序段:struct st{int n;struct st *next;};static struct st a[3]={5,a[1],7,a[2],9,'\0'),*p;p=a[0];下面选项中,其值为6的表达式为______。A.P++->nB.p->n++C.(*p).n++D.++p->n

考题 下列程序的输出结果是( )。 include main() { struct st { int y,x,z; }; union {long 下列程序的输出结果是( )。 #include <stdio.h> main() { struct st { int y,x,z; }; union { long i; int j; char k; } un; printf("%d,%d\n",sizeof(struct st),sizeof(un)); }A.6, 2B.6, 4C.8, 4D.8, 6

考题 若有以下说明和语句: struct st{int n;char*ch;} struct st a[3]={5,"abc"7,"def",9",ghk"),*p=a; 则值为6的表达式是______。A.p++->nB.p->n++C.(*p).n++D.#NAME?

考题 有以下程序 include struct st { int x,y;} data[2]={1,10,2,20}; main( 有以下程序 #include <stdio.h> struct st { int x,y;} data[2]={1,10,2,20}; main() { struct st *p=data; printf("%d,",p->y); printf("%d\n",(++p)->x); } 程序的运行结果是______。A.10,1B.20,1C.10,2D.20,2

考题 若有以下说明和语句: struct st{int n;char * ch;}; struct st a[3]={5,"abc",7,"def",9,"ghk"},*p=a; 则值为6的表达式是 ______。A.p++->nB.p->n++C.(*p).n++D.++p->n

考题 若定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。 struct st { int x; int y; int z; } struct worker { char name[20]; char sex; struct st birth; }p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

考题 有以下程序 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

考题 设定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。Struct st{ int x;inty;int z;}Struct worker{ char name[20];char sex;struct st birth;}p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

考题 若有下列说明和语句,已知int型数据占2个字节,则下列语句的输出结果是( )。 struct st { char a[15]; int b; double c; }; printf("%d",sizeof (struct st));A.15B.8C.25D.2

考题 设有以下程序: struct st{int n;struct st *next;}; static struct st a[3]={5,a[1],7,struct st *next;}; static struct st a[3]={5,a[1],7,a[2],9,'\0'},*p; p=a [0]; 下面选项中,表达式值为6的是______。A.p++->nB.p->n++C.(*p).n++D.++p->n

考题 若有下列说明和语句,则对结构体变量st中成员i的引用方式不正确的是( )。 Struct stu { int i; int name; }st,*p; p=st;A.st.iB.*p.iC.(*p).iD.p->i

考题 设定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。 stmct st { int x; int y; int z; } struct worker { char name[20]; char sex; struct st birth; }p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

考题 设有以下语句 ( ) struct st {int n;struct st * next;}; static struct st a [3]={5,a [1],7,a[2],9,'\0'},*p; p=a[0] 则表达式( )的值是6。A.p+ + ->nB.p->n + +C.(* P). n+ +D.+ +p - >n

考题 若有以下定义和语句 struct a{ int n,m;}; struct a st[3]={{2,3},{4,5},{6,7}}; struct a*p=st;则以下错误的引用是A.(p++)-n; B.st[0].n; C.(*p).n; D.P=st.m,

考题 有以下程序: 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

考题 设有以下程序: struct st{int n;struct st*next;}; static struct st a[3]={5,a[1],7,a[2],9,'\0\},*p; p=a[0];下面其值为6的表达式为______。A.p++->nB.p->n++C.(*p).n++D.++p->n

考题 以下程序的输出结果是 ( ) struct st { int x; int * y;} * p; int dt[4]={10,20,30,40}; struct st aa[4]={50,dt[0],60, dt[0],60 dt[0],60,dt [0]}; main( ) { p=aa; printf("%d\n",+ +(p->x)); }A.10B.11C.51D.60

考题 有以下程序 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

考题 以下对结构体类型变量td的定义中,错误的是( )。A.typcdef struct aa { int n; float m; } AA; AA td;B.struct aa {int n; float m; } struct aa td;C.struct {int n; float m; } aa; struct aa td;D.struct {int n; float m; }td;

考题 单选题有如下定义:struct st{ int a; float b;}x[10];FILE *fp;若文件已正确打开,且数组x的10个元素均已赋值,以下将数组元素写到文件中的语句错误的是(  )。A for(i=0; i10; i++) fwrite(x,sizeof(struct st), 1,fp);B fwrite(x,10*sizeof(struct st), 1,fp);C fwrite(x,sizeof(struct st), 10,fp);D for(i=0; i10; i++) fwrite(x[i],sizeof(struct st), 1,fp);

考题 单选题若有以下程序段struct st{ int n; struct st*next;};struct st a[3] = {5,a[1],7,a[2],9,'\0'}, *p;p = a[0];则以下选项中值为6的表达式是(  )。A p-n++B (*p).nC ++(p-n)D p-n