设有以下程序段: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 n;struct st *next;};static struct st a[3]={5,&a[1],7,&a[2],9,'\0'),*p;p=&a[0];下面选项中,其值为6的表达式为______。

A.P++->n

B.p->n++

C.(*p).n++

D.++p->n


相似考题
参考答案和解析
正确答案:D
更多“设有以下程序段:structst{intn;structst *next;};staticstructsta[3]={5,&a[1],7,&a[2], ”相关问题
  • 第1题:

    设有以下程序: 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++->n

    B.p->n++

    C.(*p).n++

    D.++p->n


    正确答案:D
    解析:p指向数组的第1个元素,由于运算符->优先级高于运算符++,可知选项A应先取p->n的值5,再使p++指向下一个元素;选项B,先取p->n的值5作为表达式的值,再使p->n的值加1;选项C与选项B等价:选项D,先使p->n的值增1(即值为6),再以此值作为表达式的值,本题应选择选项D。

  • 第2题:

    设有下列语句: ()表达式的值为7. struct st {int n; struct st *next;}; static struct st a[3]={ 5,&a[1], 7,&a[2], 9,NULL}, *p; p=&a[0];

    A.p->n++

    B.(p)->n

    C.(*p).n++

    D.p++->n


    B

  • 第3题:

    设有以下语句,则以下表达式的值为6的是: struct st { int n; struct st *next; }; static struct st a[3]={5,&a[1],7,&a[2],9,'0'},*p; p=&a[0];

    A.p++->n

    B.p->n++

    C.(*p).n++

    D.++p->n


    x %= x-2;

  • 第4题:

    设有下列语句: ()表达式的值为6. struct st {int n; struct st *next;}; static struct st a[3]={ 5,&a[1], 7,&a[2], 9,NULL}, *p; p=&a[0];

    A.++p->n

    B.(p)->n

    C.(*p).n++

    D.p++->n


    int* f(int*(*fp)(int *, int)){return fp(nullptr,3); }

  • 第5题:

    设有以下说明和定义语句 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++->n

    B.p->n++

    C.++p->n

    D.(*p).n++


    struct st a; a.x=10;