首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #include struct A { int a; char b[10]; double c; }; void f(struct A t); main() { struct A a={1001,"ZhangDa"
有以下程序 #include #include struct A { int a; char b[10]; double c; }; void f(struct A t); main() { struct A a={1001,"ZhangDa"
admin
2015-07-28
45
问题
有以下程序
#include
#include
struct A
{
int a;
char b[10];
double c;
};
void f(struct A t);
main()
{
struct A a={1001,"ZhangDa",1098.0};
f(a);
printf("%d,%s,%6.1f\n", a.a,a.b,a.c);
}
void f(struct A t)
{
t.a=1002;
strcpy(t.b,"ChangRong");
t.c=1202.0;
}
程序运行后的输出结果是( )。
选项
A、1001,ZhangDa,1098.0
B、1002,ChangRong,1202.0
C、1001,ChangRong,1098.0
D、1002,ZhangDa,1202.0
答案
A
解析
函数f()传递的参数为结构体变量,也是一种值传参,形参的变化不能影响到实参,所以调用函数f(a)对a中的数据没有影响。所以输出结果为选项A)。
转载请注明原文地址:https://kaotiyun.com/show/kKJp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序 int f1(int x,int y){return x>y?x:y; } int f2(int x,int y){return x>y?y:x; } main() { int a=4,b=3,c=5,d=2,e,f,g; e=f2(f1(a,
以下程序的输出的结果是______。intx=3;main(){inti;for(i=1;i<x;i++)incre();}incre(){staicintx=1
下面能正确进行字符串赋值操作的语句是______。
以下程序运行后的输出结果是______。 main() { char a[]="ABCDEFGH",b[]="abCDefGh"; char*p1,*p2;int k; p1=a;p2=b; for(k=0;k<=7;k++) if*(p1+k)==*(p
执行下面程序段的结果是______。 int x=234; do { printf("%3d\n",x--); } while(!x);
在循环结构中,______可以使得同一组语句一次也不执行。
下列4条叙述中,正确的一条是______。
以下叙述中正确的是______。
下列选项中不属于结构化程序设计原则的是
下列叙述错误的是()。
随机试题
对人的精子的叙述,正确的是()。
实践之所以高于理论,是由于实践具有()。
易发生冻结的药品有易氧化的药品有
在房地产营销中,房地产经纪人对()分析来确定应采取的营销方式。
重金属中纯镍是银白色的金属,不属于其特性的是()。
《商业银行房地产贷款风险管理指引》规定,商业银行应根据各地市场情况的不同制订合理的贷款成数上限,但所有住房贷款的贷款成数不超过()。
Killingasoldierremovesoneenemyfromthebattle.Woundinghimremovesthree:thevictimandthetwowhohavetocarryhimfr
Menhavedistinguishedthemselvesfromotheranimals,andindoingsosecuredtheirsurvivalbytheabilitytoobserveand
DoctorAdamsexplainedthatnotallbacteriaharmful.
A、Becausepeoplearefreeinsummer.B、Becausethisisatraditionalfestival.C、Becausesummeristhetimeforoutdoormusicfe
最新回复
(
0
)