题目内容

以下选项中,不能定义s为合法的结构体变量的是( )。

A. struct abc{double a;charb[10];} s;
B. struct {double a;charb[10];} s;
C. struct ABC{double a;charb[10];} ;struct ABC s;
D. struct s {double a;charb[10];} ;

查看答案
更多问题

有定义“struct ex { it x; float y; char z; } example; ”,下面叙述中不正确的是( )。

A. struct是定义结构类型的关键字
B. example是结构类型名
C. x, y, z都是结构成员名
D. struct ex是结构类型名

下列程序的输出结果是( )。struct S { int n; int a[20]; };void f(int *a, int n){int i;for(i = 0; i < n - 1; i++) a[i] = a[i] + i;}int main(void){int i; struct S s={ 10,{ 2, 3, 1, 6, 8, 7, 5, 4, 10, 9 }};f(s.a, s.n);for(i = 0; i < s.n; i++) printf("%d,", s.a[i]);}

A. 2, 4, 3, 9, 12, 12, 11, 11, 18, 9,
B. 3, 4, 2, 7, 9, 8, 6, 5, 11, 10,
C. 2, 3, 1, 6, 8, 7, 5, 4, 10, 9,
D. 1, 2, 3, 6, 8, 7, 5, 4, 10, 9,

下列程序的结果是( )。typedef struct { char name[9]; char sex; float score[2]; }STU;void f (STU a){STU b = {"Zhao", 'm', 85.0, 90.0}; int i;strcpy(a.name, b.name);a.sex = b.sex;for(i = 0; i < 2; i++) a.score[i] = b.score[i];}int main(void){STU c = {"Qian". 'f', 95.0, 92.0};f ( c );printf("%s, %c, %2.0f, %2.0f\n", c.name, c.sex, c.score[0], c.score[1]);return 0;}

A. Qian, f, 95, 92
B. Qian, m, 85, 90
C. Zhao, f, 95, 92
D. Zhao, m, 85, 90

下列程序的输出结果是( )。struct stu { int num; char name[10]; int age; };void fun(struct stu *p){printf("%s\n",(*p).name;}int main(void){struct stu students[3] = {{9801, "Zhang", 20}, {9802, "Wang",19}, {9803, "Zhao",18}}; fun(student + 2);}

A. Zhang
B. Zhao
C. Wang
D. 18

答案查题题库