若有以下定义和语句,则对w数组元素非法引用的是______。 int w[2][3],(*pw)[3];pw=w;
A.w[0]+2
B.*(pw+1)[2]
C.pw[0][0]
D.*(pw[1]+2)
第1题:
( 38 )有以下定义和语句
struct workers
{ int num;char name[20];char c;
struct
{ int day; int month; int year; } s;
} ;
struct workers w,*pw;
pw = &w;
能给 w 中 year 成员赋 1980 的语句是
A ) *pw.year = 198O;
B ) w.year=1980;
C ) pw->year=1980;
D ) w.s.year=1980;
第2题:
若有一些定义和语句 #include <stdio.h> int a=4,b=3,*p,*q,*w; p=&a; q=&b; w=q; q=NULL; 则以下选项中错误的语句是
A.*q=0;
B.w=p;
C.*p=va;
D.*p=*w;
第3题:
若有定义: int w[3][5]; ,则以下不能正确表示该数组元素的表达式是
A)*(*w+3)
B)*(w+1)[4]
C)*(*(w+1))
D)*(&w[0][0]+1)
答案C
解析:在 C 语言中,二维数组的名字表示的是二维数组的地址,表达式 * ( w+1 )表示的是二维数组的第 1 行的第 2 元素。在其前面再加上 * ( * ( w+1 ) )就是错误的表达式。
第4题:
若有以下定义和语句: int s[4][5],(*p)[5]; p=s; 则指针对s数组中第三个元素的正确引用形式是( )。
A.p[0][3]
B.p[1][2]
C.p[0][2]
D.p[1][3]
第5题:
若有以下定义和语句,则对a数组元素地址的正确引用为 int a[2][3],(*p)[3]; p=a;
A.*(p+2)
B.p[2]
C.p[1]+1
D.(p+1)+2
第6题:
若有定义:int w[3][5];,则以下不能正确表示该组元素的表达方式是______,
A.*(*w+3)
B.*(w+1)[4]
C.*(*(w+1))
D.*(&w[0][0]+1)
第7题:
A. pt[0][0]
B. *(pt+1)[2]
C. *(pt[1]+2)
D. *(a[0]+2
第8题:
若有定义: int a[2][3]; ,以下选项中对 a 数组元素正确引用的是
A)a[2][!1]
B)a[2][3]
C)a[0][3]
D)a[1>2][ !1]
第9题:
若有以下定义和语句,则对w数组元素的非法引用是 ______。 int w[2][4],(*pw)[4];pw=w;
A.*(w[0]+2)
B.*pw[2]
C.pv[0][0]
D.*(pw[1]+2)
第10题:
有以下定义和语句: struct students {int num;char name[20];char c; struct {int grade1;int grade2;}s; }; struct students w,*pw; *pw=w; 下列赋值语句不正确的是( )。
A.w.num=1002;
B.w.grade1=85;
C.pw->num=1002;
D.w.s.grade2=85;