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); }
举一反三
- struct abc {int a,b,c;} main() {struct abc s[2]={{1,2,3},{4,5,6}};int t; t=s[0].a+s[1].b;printf("%d ",t); }
- struct abc {int a,b,c;};main(){struct abc s[2]={{1,2,3},{4,5,6}};int t;t=s[0].a+s[1].b;printf("%d ",t); }的输出结果是( ) 。
- 写出下面程序的运行结果。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;}
- 以下程序的运行结果是s=2,t=3#include ;using namespace std;int main(){ int s=1,t=1,a=5,b=2; if (a>;0) s++; if (a>;b) t+=s; else if (a==b) t=5; else t=2*s; cout return 0;}
- 下列程序的输出结果是 。#includeint f(int t[], int n);void main(){int a[4]={1, 2, 3, 4}, s;s=f(a, 4); printf("%d\n", s);}int f(int t[], int n){if(n>;0) return(t[n-1]+f(t,n-1));else return(0);}