下列语句错误的是( )。
A.char*p="John";P[2]='a';
B.char name[5]="John";name[2]='a'
C.char name[5]="John",*p=name;p[2]='a';
D.char name[5]="John",*p=&name[2];*p='a';
第1题:
根据下列的定义,能打印出字母P的语句是( )。 struct stu {char name[10]; int age; }; struct sm s[10]={"John",11, "Pau1",12, "Mary",11, "adam",12 };
A.printf("%c",s[3].name);
B.printf("%c",s[3].name[1]);
C.printf("%c",s[2].name[1]);
D.printf("%c",s[1].name[0]);
第2题:
根据下面的定义,能打印出字母 M 的语句是 struct person {char name[9]; int age; }; struct person class[10]={"John",17,"Paul",19, "Mary",18, "adam",16};
A.printf("%cn",class[3].name);
B.printf("%cn",class[3].name[1]);
C.printf("%cn",class[2].name[1]);
D.printf("%cn",class[2].name[0]);
第3题:
根据以下定义,不能输出字母M的语句是(). struct person {char name[9]; int age; }; struct person class[4]={{"John",17},{"Paul",19},{"Mary",18},{"Adam",16}};
A.printf("%cn",class[2].name);
B.printf("%cn",*class[2].name);
C.printf("%cn",class[2].name[0]);
D.printf("%cn",class[2].name[0]++);
第4题:
根据下面的定义,能打印出字母P的语句是() struct person { char name[9]; int age;}; struct person classes[10]={"John",17, "Paul",19,"Mary",18, "Adam",16};
A.printf("%cn",classes[2].name);
B.printf("%cn",classes[2].name[1]);
C.printf("%cn",classes[1].name[0]);
D.printf("%cn",classes[1].name[1]);
第5题:
根据下面的定义,能输出Mary的语句是() struct person { char name[9]; int age; }; struct person class[5]={"John",17,"Paul",19,"Mary",18,"Adam",16};
A.printf("%sn" ,class[1].name);
B.printf("%sn" ,class[2].name);
C.printf("%sn" ,class[3].name);
D.printf("%sn" ,class[0].name);