题目内容

以下程序的输出结果是( )。struct Stu {int num;char name[10];} x[5]= {1,"Iris",2,"Jack",3,"John",4,"Mary",5,"Tom"};int main() {for (int i=3; i<5; i++) printf("%d%c",x[i].num,x[i].name[0]);return 0;}

A. 3J4M5T
B. 4M5T
C. 3J4M
D. 1I2J3J

查看答案
更多问题

以下程序的输出结果是( )。struct Date {int year;int month;};struct Stu {Date birth;char city[20];} x[4]= {{2010,4,"Hangzhou"},{2009,7,"Shaoxing";int main() {printf("%c,%d\n",x[1].city[1],x[1].birth.year);return 0;}

A. a,2010
B. H,2010
C. S,2009
D. h,2009

根据下面的结构体数组定义,能输出Mary的语句是( )。struct Stu{char name[9];int age;} p[5]={"John",18,"Iris",19,"Mary",17,"Jack",16};

A. printf("%s\n",p[1].name);
B. printf("%s\n",p[3].name);
C. printf("%s\n",p[2].name);
D. printf("%s\n",p[0].name);

以下程序的输出结果是( )。struct XY{int x;int y;}s[2]={5, 3, 2, 6};int main(){printf("%d\n",s[0].y*s[1].y);return 0;}

A. 30
B. 6
C. 10
D. 18

以下程序的输出结果是( )。struct XY{int x;int y;}s[10]={5, 3, 2};int main(){printf("%d\n",s[1].x*s[1].y);return 0;}

A. 15
B. 6
C. 0
D. 不确定

答案查题题库