有声明int a[]={8.2.5}、*p=a;则取值为2的是()
第1题:
若已有定义int x=2; int *p=&x;则*p的值为( )
A. 2
B. &x
C. *x
D. &p
第2题:
有以下程序: #include<stdio.h> struct tt {int x;struct tt*y;}*p; struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a} main() { int i; p=a; for(i=1;i<=2;i++){printf("%d",p->x);p=P->y;} } 程序的运行结果是( )。
A.20,30,
B.30,17
C.15,30
D.20,15
第3题:
设有以下定义: int a[4][3]={1,2,3,4,5,6,7,8,9,10,11,12}; int(*ptr)[3]=a,*p=a[0];则下列能够正确表示数组元素a【1】【2】的表达式是( )。A.*((*ptr+1)[2])B.*(*(p+5))C.(*ptr+1)+2D.*(*(a+1)+2)
第4题:
在下列叙述中,错误的一条是______。
A.有下列语句组,则c=(*p)(a,b)与c=max(a,b)等价 int max();int(*p)();int c;p=max;
B.执行下列语句后,则*p的值为1 int a=1,*p;*p=&a;
C.已知指针变量p1指向数组元素a[1],p2指向数组元素a[4],则p2-p1=4-1=3
D.2个指针变量指向同一数组时可以进行比较,其值为1或0
第5题:
有以下程序: #include<stdio.h> struct tt { int x;struct tt *y;} *p; struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a}; main() {int i; p=a; for(i=1;i<=2;i++) {printf("%d,",p->x);p=p->y;} } 程序的运行结果是( )。
A.20,30,
B.30,17
C.15,30,
D.20,15,
第6题:
定义如下一维数组:int a[5],*p;,则下列描述错误的是( )。
A.表达式p=p+1是合法的
B.表达式a=a+1是合法的
C.表达式p-a是合法的
D.表达式a+2是合法的
第7题:
执行下面的语句后,表达式*(p[0]+1)+**(q+2)的值为______。 int a[]={5,4,3,2,1},*p[]={a+3,a+2,a+1,a},**q=p;
A.8
B.7
C.6
D.5
第8题:
下列程序的运行结果为
#include<iostream.h>
void main( )
{
int a=2;
int b=a+1;
cout < < a/b < < endl;
}
A.0.66667
B.0
C.0.7
D.0.66666666…
第9题:
有以下定义: int a[4] [3]={1,2,3,4,5,6,7,8,9.10,11,12}; int(*ptr)[3]=a,*p=a[0]; 则下列能够正确表示数组元素a[1][2]的表达式是( )。
A.*((*ptr+1}+2)
B.*(*(p+5))
C.(*ptr+1)+2
D.*(*(a+1)+2)
第10题:
下列程序的运行结果为 #include < iostream.h > void main( ) { int a=2; int b=a+l; cout < < a/b < < end1; }
A.0.66667
B.0
C.0.7
D.0.66666666…