设有如下定义,struct ss{ char name[10];int age;char sex; }std[3],*p=std;下面输入语句中错误的是( )
A. scanf(“%d”, &(*p).age);
B. scanf ("%s",&std.name);
C. scanf(“%c”,&std[0].sex);
D. scanf ("%c", &(p->sex));
下面程序的输出结果是( )struct S{int n;int a[20];};void f(int *a,int n){ int i; for(i=0;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
下列程序的输出结果是( )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(students+2);}
A. Zhang
B. Zhao
C. Wang
D. 18
下列程序的输出结果时( )struct STU{ char name[10]; int num;};void f(char *name,int num){ struct STU s[2]={{"SunDan",20044},{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name);}int main(void){ struct STU s[2]={{"YangSan",2004},{"LiSiGou",20042}},*p; p=&s[1]; f(p->name,p->num); printf("%s%d\n",p->name,p->num); }
A. SunDan 20042
B. SunDan 20044
C. LiSiGou 20042
D. YangSan 20041