首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #defineN4 voidfun(inta[][N],intb[]) {inti; for(i=0;i<N;i++)b[i]=a[i][i]; } main() {intx[][N]={{1,2,3},{4},{5,6,7,
有以下程序 #include #defineN4 voidfun(inta[][N],intb[]) {inti; for(i=0;i<N;i++)b[i]=a[i][i]; } main() {intx[][N]={{1,2,3},{4},{5,6,7,
admin
2015-07-31
56
问题
有以下程序
#include
#defineN4
voidfun(inta[][N],intb[])
{inti;
for(i=0;i<N;i++)b
=a
;
}
main()
{intx[][N]={{1,2,3},{4},{5,6,7,8},{9,10}},y[N],i;
fun(x,y);
for(i=0;i<N;i++)printf("%d,",y
);
printf("\n");
}
程序的运行结果是
选项
A、1,0,7,0,
B、1,2,3,4,
C、1,4,5,9,
D、3,4,8,10,
答案
A
解析
该程序首先在定义变量时,对二维数组x[][N]进行赋值操作;调用函数fun,函数fun的功能是将二维数组中的a[0][0]、a[1][1]、a[2][2]和a[3][3]赋值给一维数组。最后将一维数组1,0,7,0,输出。
转载请注明原文地址:https://kaotiyun.com/show/q1Dp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下程序运行后的输出结果是【】。fun(inta){intb=0;staticintc=3;b++;c++;return(a+b+c);}main(){int
以下程序运行后的输出结果是【】。voidswap(intx,inty){intt;t=x;x=Y;Y=t;printf("%d%d",x,y);}main(){inta=3,b=4;sw
以下程序运行后的输出结果是【】。main(){charCl,c2;for(c1=’0’’c2=’9’;c1<c2;c1++,c2--)printf("%c%c",c1,c2);printf("\n"
下列程序的输出结果是______。char*fun(char*str,intn){inti;char*p=str;for(i=0;i<10;i++,str++)*str=’a’+i;
下列程序的运行结果是______。main(){inta[6],i;for(i=2;i<6;i++){a[i]=4*(i-2*(i>3))%5;printf("%2d",a[i]);
下列程序的执行结果是______。in(f(char*s){char*p=s;while(*p!=’\0’)p++;return(p-s);}main(){prin
下列程序段的执行结果是______。inti;intx[][3]=}1,2,3,4,5,6,7,8,9};for(i=0;i<3;i++)printf("%d",x[i][2-i]);
以下能正确对整型数组赋初值的语句是______。
在16位C编译系统上,若定义longa;,则能给变量a赋值40000的正确语句是______。
下列能正确定义一维数组的选项是()。
随机试题
足部鼻反射区适应症包括()。
试述劳动者违反劳动合同的赔偿责任。
以人体肾脏严重受损,骨质软化、疏松和变形为主要症状的慢性中毒,是由于环境()污染通过食物链而引起的
A、水提醇沉法B、醇提水沉法C、醇提醚沉法D、铅盐沉淀法E、酸提碱沉法用酸性水从药材中提取出生物碱后再使其从水中析出的方法为()
根据现行制度规定,A股的佣金根据成交金额按比例收取,起点为1元。()
A.marineB.havediscoveredC.slowsPhrases:A.Thisturbulencemusesfrictionand【T1】______thefishdownB.Anotherkindof【
下列选项中,不属于沈家本参与制定的法律是()。
Aperson’shomeisareflectionofhispersonality.Dependingonpersonality,mosthaveinminda(n)"【C1】______home".Butingen
(1)GeraldFeinberg,theColumbiaUniversityphysicist,oncewentsofarastodeclarethat"everythingpossiblewilleventually
Perhapsthemythoftheperfectcommunicatorcomesfrombelievingtoostronglyinnovels,television,orfilms.Intheseplaces
最新回复
(
0
)