单选题 C语言
题号 #2268716

有以下程序:  
#include<stdio.h>
#include<string.h>   
struct A
{int a;char b[10];double C;);
struct A f(struct A t):
main(  )
{struct A a={1001,"ZhangDa",l098.0};
 a=f(a);printf("%d,%S,%6.1f\n",a.a,a.b,a.c);
}
struct A f(struct A t)   
{t.a= 1002;strcpy(t.b,"ChangRon9");t.c=1202.0;return t;}
程序运行后的输出结果是(  )。

进入在线模考

参考答案

D

答案解析

本题考查了结构体函数的调用。定义了结构体A,A含有三个参数分别是整型,字符型和双精度型。主函数中调用了fun(),转到struct A f(struct A t)函数中,内容分别变成了{1002,Chan-gRong,1202.2),函数调用后,格式仍为struct A a={1001,"ZhangDa",l098.0);的格式。所以D选项为正确答案。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考