牛客刷题记录--C++

mac2022-06-30  84

设有以下程序段,则值为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];选项:

p++->n++p->np->n++(*p).n++

答案++p->n。因为->的优先级高于++,p->n 为5。

下列选项,不正确的是()

for(int a=1;a<=10;a++);int a=1;do{a++;}while(a<=10)int a=1;while(a<=10){a++;}for(int a=1;a<=10;a++)a++;答案:B。while后面没有分号。

转载于:https://www.cnblogs.com/robertgao/p/11520022.html

相关资源:牛客网面试宝典.zip
最新回复(0)