首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的输出结果是 #include<iostream.h> int b=2; int func(int *a) {b+=*a;return(b) ;} void main( )
下列程序的输出结果是 #include<iostream.h> int b=2; int func(int *a) {b+=*a;return(b) ;} void main( )
admin
2010-03-29
16
问题
下列程序的输出结果是 #include<iostream.h> int b=2; int func(int *a) {b+=*a;return(b) ;} void main( ) { int a=2,res=2; res+=func(&a) ; cout<<res;}
选项
A、4
B、6
C、8
D、10
答案
2
解析
在函数体语句中的b+=*a;的 *是指针运算符(也称间接访问运算符),*a就是main函数中a的值。
转载请注明原文地址:https://kaotiyun.com/show/Ijjp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
以下程序:include<stdio.h>main(){charstr[10];scanf("%s",&str);printf("%s\n",str);}运行上面的程序,输入字符串“howareyou”,则程序的执行结果是()。
使用VC++2010打开考生文件夹下modi1中的解决方案。此解决方案的项目中包含一个源程序文件mMi1.c。在此程序中,函数fun的功能是:从P所指字符串中找出ASCII码值最大的字符,将其放在第一个位置上,并将该字符前的原字符向后顺序移动。例如,调用
请编写函数fun,其功能是:计算并输出下列多项式的值:例如,在主函数中从键盘给n输入15,则输出为:s=2.718282。注意:要求n的值大于1但不大于100。部分源程序在文件PROGl.C中。请勿改动主函数mai
下列给定程序中,函数fun的功能是:在形参ss所指字符串数组中查找与形参t所指字符串相同的串,找到后返回该串在字符串数组中的位置(即下标值),若未找到则返回一I。ss所指字符串数组中共有N个内容不同的字符串,且串长小于M。清在程序的下画线处填入正
给定程序中,函数fun的功能是将参数给定的字符串、整数、浮点数写到文本文件中,再用字符串方式从此文本文件中逐个读入,并调用库函数atoi和atof将字符串转换成相应的整数、浮点数,然后将其显示在屏幕上。请在程序的下划线处填入正确的内容并把下划线删
n个顶点的连通图中边的条数至少为()。
在C++中,实现封装性需借助于
面向对象程序设计支持的3大特性为:封装性、继承性和【】。
在一个图中,所有顶点的度数之和等于所有边数的【 】倍。
在C++语言中,数据封装要解决的问题是
随机试题
保持我国经济持续健康发展,要求加快转变经济发展方式,推动产业结构升级。下列做法符合这一要求的是()。①促进金融、通讯等服务业发展②加大研发投入,推进科技创新③增加出口补贴,扩大出口规模④提高存款利率,减少居民消费
交磁电机扩大机中补偿绕组的并联电阻如出现断路故障,会导致加负载后电压()。
大多数肺隔离症的供血来自
A.0.5L/minB.1L/minC.1.5L/minD.1~3L/minE.4L/min头罩法给氧的氧流量为
下列有关审计报告的相关说法不正确的是:()
Asathird-generationnativeofBrownsville,Texas,MildredGarzaneverplannedtomoveaway.Evenwhenherdaughterandsonask
记忆的三个存储模型认为,记忆加工有三个不同的阶段,它们分别是感觉记忆、短时记忆和长时记忆。其中信息加工系统的核心是()。
,()
“shuǎng(爽)”这个音节()。
Nowadays,airtravelisvery【C1】______WearenotsurprisedwhenwewatchonTVthatapoliticianhastalkedwithFrenchPresiden
最新回复
(
0
)