有以下程序 #include<stdio.h> struct STU{char name[9];char sex;int score[2];}; void f(struct STU a[]) {struct STU b={"zhao",’m’,85,90}

admin2016-12-18  11

问题 有以下程序
#include<stdio.h>
struct STU{char name[9];char sex;int score[2];};
void f(struct STU a[])
{struct STU b={"zhao",’m’,85,90};
a[1]=b;}
main()
{struct STU c[2]={{"Qian",f,95,92},{"Sun",’m’,98,99}};
f(c);
printf("%s,%c,%d,%d,",c[0].name,c[0].sex,c[0].sc

选项 A、Qian,f,95,92,Sun,m,98,99
B、Zhao,m,85,90,Sun,m,98,99
C、Qian,f,95,92,Zhao,m,85,90
D、Zhao,m,85,90,Qian,f,95,92

答案C

解析 在主函数中,定义了结构体STU数组c[2],并对其赋初始值。执行f(c)时,在函数f()中,把结构体变量b的值赋给了c[1]。
转载请注明原文地址:https://kaotiyun.com/show/BADp777K
0

随机试题
最新回复(0)