首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设有如下程序: fun(float*p1,int n,float*p2,int m,float*s) {int i; *s=0.0; for(i=0;i<n;i++)*s+=*p1++; for(i=0;i<m;i++)
设有如下程序: fun(float*p1,int n,float*p2,int m,float*s) {int i; *s=0.0; for(i=0;i<n;i++)*s+=*p1++; for(i=0;i<m;i++)
admin
2013-02-23
37
问题
设有如下程序: fun(float*p1,int n,float*p2,int m,float*s) {int i; *s=0.0; for(i=0;i<n;i++)*s+=*p1++; for(i=0;i<m;i++)*s+=*p2++; } main() { float a[]={1.1,2.2},b[]={1.0,2.0,3.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是______。
选项
A、8.2
B、9.3
C、3.3
D、1.1
答案
1
解析
实参指针变量s指向数组a的第一个元素,在函数fun中首先将s所指数组a的第一个元素赋值为0.0,然后将数组a和b中的元素值依次累加到数组a的第一个元素中。
转载请注明原文地址:https://kaotiyun.com/show/RFJp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下程序的运行结果为【】。#defineN5main(){inta[N]={1,2,3,4,5},i,temp;for(i=0;i<N/2;i++){temp=a[i];a[i]=a[N-i-1];
当a=1、b=3、c=5、d=4时,执行下面一段程序后,x的值为______。if(a<b)if(c<d)x=1;elseif(a<c)if(b<d)x=2;elsex=3;elsex
以下程序的输出结果是______。main(){charw[][10]={"ABCD","EFGH","IJKL","MNOP"),k;for(k=1;k<3;k++)printf("%s\n",w[k]);}
以下程序的输出结果是______。#includemain(){char*p1,*p2,str[50]="ABCDEFG";p1="abcd";p2="efgh";strcpy(str+1,p2+1);strcpy(str+3,p1+3)
下面程序的功能是输出数组中最大的数,由a指针指向该元素。请填空。main(){ints[]={6,7,2,13,9,1,12,10,5,8,4,3,11},*a,*b;for(b=s,a=s;b-s<13;b++)if(【】)
若主函数中有以下定义和语句:main(){doublea[3][4];……fun(a);}则正确的fun函数的首部是()
C语言规定函数返回值的类型由()
在对文件进行操作的过程中,若要使文件位置的指针回到文件的开头,应使用的函数是【】。
以下程序中函数sort的功能是对a数组中的数据进行由大到小的排序voidsort(inta[],intn){inti,j,t;for(i=0;i<n-1;i++)for(j=i+1;<n;j++
随机试题
《声声慢》是一首慢词,婉约词,是作者前期词的代表作品。()
下列情况中,交割仓库应承担赔偿责任的有()。
1689年《权利法案》颁布的主要意义在于()。
如果你打算拍一部以18世纪的英国为背景的影片,下列不可能在影片中出现的情景是()。
AftertheWarofIndependence,Americansdesignedanewsystem.Whatit?
Therearevariouswaysinwhichindividualeconomicunitscaninteractwithoneanother.Threebasicwaysmaybedescribedasth
A、Stomachcancer.B、Skincancer.C、Lungcancer.D、Bloodcancer.AA是老师提到阳光可以防御癌症后列举的例子之一。B是曝晒导致的。
A、Seeifhequalifiesforastudentloan.B、Makeaproposaltothegovernment.C、Starttosaveuptopayforhiskidstogotos
FootballandMoneyWhywasitfootball,ratherthantheothergreatVictoriansports,thatcapturedtheworld?Onereasonma
A、Whethertoaccepthisboss’sjoboffer.B、Whethertoapplytotransfertoanotherplace.C、Whethertofindanewjob.D、Whethe
最新回复
(
0
)