有以下程序 # include #include Struct A { int a;charb[10];double c;}; struct A f(struct A t); main() {structA a={1001,"ZhangDa",10

admin2020-05-19  32

问题 有以下程序
# include
#include
Struct A
{  int a;charb[10];double c;};
   struct A f(struct A t);
main()
{structA a={1001,"ZhangDa",1098.O};
a=f(a);printf("%d,%s,%6.1 f\n",a.a,a.b,a.c);
}
structA f(StructAt)
{  t.a=1002;strcpy(t.b,"ChangRong");t.c=1202.0;return t;}
程序运行后的输出结果是

选项 A、1002,ZhangDa,1202.0
B、1002,ChangRong,1202.0
C、1001,ChangRong,1098.0
D、1001,ZhangDa,1098.0

答案B

解析 在主函数中定义结构体A的变量a,并对其赋初值,再调用函数f(a),在函数f(a)中对结构体变量a的各个成员重新进行了赋值操作,并把其值返回在屏幕上输出。
转载请注明原文地址:https://kaotiyun.com/show/EyCp777K
0

相关试题推荐
最新回复(0)