写出下面程序的运行结果。struct abc{ int a; float b; char *c; }; int main(void) { struct abc x = {23,98.5,"wang"}; struct abc *px = &x; printf("%d, %s, %.1f, %s \n", x.a, x.c, (*px).b, px->c ); return 0;}
举一反三
- 下列程序的输出结果是( )。 struct abc{ int a; float b; char c[10]; } int main() { static struct abc x={23, 98.53, “wang”}; struct abc *px= &x; printf(“%d %.1f %s ”, x.a, x.b, x.c ); printf(“%d %.1f %s ”, px->a, (*px).b, px->c); printf(“%c %s”, *px->c+2,&px->c[1]); }
- struct abc {int a,b,c;}; void main(){ struct abc s[2]={{1,2,3},{4,5,6}}; int t; t=s[0].a+s[1].b; printf("%d\n",t); }
- 以下结构体说明和变量定义中,正确的是( )。 A: struct abc{ int n;double m );struct abc x, y; B: struct ABC{ int n;double m; }struct ABC x, y; C: typedef struct abc{ int n;double m; }ABC;ABC x,y; D: D) struct abc{ int n;double m; };abc x,y;
- 以下结构体说明和变量定义中,正确的是( ) A: typedef struct abc{ int n;double m; }ABC;ABC x,y; B: struct abc{ int n;double m };struct abc x, y; C: struct ABC{ int n;double m; }struct ABC x, y; D: struct abc{ int n;double m; };abc x, y;
- 下列程序的输出结果为_________。 #include struct abc { char c; float v; }; void main() { abc a={'B',98.5}; cout