首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include int funa(int a,int b){ return a+b;} int funb(int a,int b){return a-b;) int sss(int(*t)(),in
有以下程序 #include int funa(int a,int b){ return a+b;} int funb(int a,int b){return a-b;) int sss(int(*t)(),in
admin
2019-06-09
13
问题
有以下程序
#include
int funa(int a,int b){
return a+b;}
int funb(int a,int b){return a-b;)
int sss(int(*t)(),int X,int Y){return((*t)(x,y));}
main(){
int x;
X=SSS(funa,9,3);
x+=sss(funb,8,3);
printf("%d\n",x);)
程序运行后的输出结果是
选项
A、17
B、23
C、24
D、22
答案
A
解析
函数funa的功能计算两个数据的和,funb的功能计算两个数据的差,函数sss中利用指向函数的指针作为函数的参数,可以在调用的时候,根据接收的函数地址来决定调用那一个函数。主函数中调用x=sss(funa,9,3),将funa函数的地址传递给t,因此sss函数成为求两个数据的和12,继续将funb函数地址传给t,求两个数据筹为5,和s累加后结果为17。
转载请注明原文地址:https://kaotiyun.com/show/J3Rp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
给定程序中,函数fun的功能是:在带有头结点的单向链表中,查找数据域中值为ch的结点。找到后通过函数值返回该结点在链表中所处的顺序号;若不存在值为ch的结点,函数返回0值。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
请编写一个函数fun,它的功能是:将SS所指字符串中所有下标为奇数位置上的字母转换为大写(若该位置上不是字母,则不转换)。例如,若输入“abc4EFg”,则应输出“aBc4EFg”。注意:部分源程序存在文件PROGl.C中。请勿改动主函数
下列叙述中正确的是()。
下列程序的输出结果是()。#includevoidmain(){inta=0,b=1,c=2;if(++a>0‖++b>0)++C:printf(“%d,%d,%d,a,b,c);
已知inta=6;则执行a+=a-=a*a;语句后,a的值为()。
算法空间复杂度的度量方法是()。
以下选项中,值为1的表达式是()。
下列叙述中正确的是()。
下列关系表达式中,结果为"假"的是()。
下面属于应用软件的是()。
随机试题
某男,其行为表现为做事动作快,总想在尽可能短的时间内完成尽可能多的工作,说话大声并具暴发性,喜欢竞争,对人怀有潜在的敌意和戒心,常常不耐烦和敌意。该男子的行为属于
固定义齿中恢复缺牙间隙的结构称作
下列关于类风湿因子(RF)与类风湿关节炎(RA)的描述,不正确的是()
2005年10月5日,甲、乙签订房屋买卖合同,约定年底前办理房屋过户登记。乙签发一张面额80万元的转账支票给甲以支付房款。一星期后,甲提示银行付款。2006年1月中旬,甲到银行要求支付支票金额,但此时甲尚未将房屋登记过户给乙。对此,下列哪些说法是正确的?(
对( ),承运人或者装箱单位必须在装运前申请适载检验,未经检验合格的不准装运。
个人贷款采取抵押担保方式的,不属于调查内容的是()。[2012年10月真题]
下列各项中,应列入资产负债表中“应收账款”项目的有()。
弗洛伊德认为人格结构主要由()构成。
若想把word某个文字段的格式连续多次复制,应()格式刷。
A、Healreadyknowsalotaboutpainting.B、Hehopestobecomeapaintersomeday.C、He’snotveryfamiliarwithpainting.D、Heh
最新回复
(
0
)