以下选项中不能正确把cl定义成结构体变量的是______。
A. typedef struct{ int red; int green; int blue;} COLOR;COLOR cl;
B. struct color cl{ int red; int green; int blue;};
C. struct color{ int red; int green; int blue;}cl;
D. struct{ int red; int green; int blue;}c1;
查看答案
以下程序的输出结果是( )。main( ){struct {int i;char c;float a;} test;printf(”%d\n”, sizeof(test));}
A. 7
B. 8
C. 9
D. 12
若结构体struct person定义如下:struct person{char name[20];int age;};则下列声明和语句正确的是( ) 。
A. struct person p1; scanf("%s%d", p1.name, p1.&age);
B. struct person p1; p1={"Zhang", 20};
C. struct person p1; scanf("%s%d", p1->name, &p1->age);
D. struct person p1={"Zhang", 20};
struct mod {int a,b,c;};main(){struct mod st[3] = {{1,2,3},{4,5,6},{7,8,9}};int total;total = st[0].a + st[1].b;printf("total=%d\n",total);}程序运行结果是( )。
A. total = 5
B. total = 6
C. total = 7
D. total = 8
已定义以下结构体数组:struct c{int x;int y;}s[2]={2,4,6,8};语句printf("%d",s[0].y*s[1].x)的结果是()。
A. 12
B. 16
C. 24
D. 32