单选题
有以下程序:
#include
#include
struct Sa
{
int num;
char name[10];
double s;
};
struct Sa f(struct Sa t);
void main()
{
struct Sa a={101,''Mary'',1098.0};
a=f(a);
printf(''%d,%s,%6.1f\n'',a.num,a.name,a.s);
}
struct Sa f(struct Sa t)
{
t.num=102;
strcpy(t.name,''Job'');
t.s=1202.0:
return t;
}
程序运行后的输出结果是( )。
【正确答案】
B
【答案解析】解析:子函数的功能是修改传入的形参变量(结构体)的属性值,并返回修改后的结构体,所以答案是B。