首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; int main() { void function(double val); double val; function(va
有如下程序: #include using namespace std; int main() { void function(double val); double val; function(va
admin
2019-06-12
44
问题
有如下程序:
#include
using namespace std;
int main()
{
void function(double val);
double val;
function(val);
cout<
return 0;
}
void function(double val)
{
val=3;
}
编译运行这个程序将出现的情况是( )。
选项
A、编译出错,无法运行
B、输出:3
C、输出:3.0
D、输出一个不确定的数
答案
D
解析
此题考查的是函数参数的传递。C++语言中,函数在传递参数时,总是将实参的值传递给被调用函数的形参,即传值调用。因此,在函数中对形参所作的任何操作都不会改变实参的值。
转载请注明原文地址:https://kaotiyun.com/show/JL8p777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
类MyClass的定义如下:classMyClass{public:MyClass(){Value=0.)SetVariable(inti){value=i;}private:int
将以下程序写成三目运算表达式是()。if(x
有以下程序:#includeusingnamespacestd;inta;intfun();intmain(){externinta;intb;
以下程序的正确运行结果是()。#includeimfun(int);voidmain(){inta=2,i;for(i=0;i
下列程序用来判断数组中特定元素的位置所在,则输出结果为()。#include#includeintfun(int*p,intn,int*j){inti;*j=0;fo
以下程序的输出结果是()。#includeusingnamespacestd;voidfun(char**q){++q;cout
随机试题
以下有关病毒的说法错误的是()
Someadultsspendalotoftimetryingtostopchildrenplaying.Theyareusuallypeoplewhothinkofplayasthe【C1】______ofwo
A.Ⅰ级B.Ⅱ级C.Ⅲ级D.Ⅳ级E.Ⅴ级不能从事任何体力活动,休息时仍有心衰症状,心功能分级为
有关卵巢下述正确的是
引起左室后负荷增高的主要因素是
刘某系甲公司的董事兼总经理,该公司主要经营计算机销售业务。任职期间,刘某代理乙公司从国外进口一批计算机并将其出售给甲公司。刘某因此得到代理费2万元。甲公司得知后提出异议。该2万元代理费的正确处理方式是()。
作为整个企业预算编制起点的是()。
在设计数据表时,如果要求“课程安排”表中的“教师编号”必须是“教师基本情况”表中存在的教师,则应该进行的操作是()。
PassageThreeThesteakhousemaybeAmerica’sgreatestsingleachievement.Sure,there’sthatConstitutioneveryone’ssoimp
Art,saidPicasso,isaliethatmakesusrealizethetruth.Soisamap.Wedonotusually【B1】______thepreciseworkofthemap
最新回复
(
0
)