首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; void fun(int a,______________) { int c; c=a; a=*b; *b=c; }
有如下程序: #include using namespace std; void fun(int a,______________) { int c; c=a; a=*b; *b=c; }
admin
2015-07-22
89
问题
有如下程序:
#include
using namespace std;
void fun(int a,______________) { int c; c=a; a=*b; *b=c; }
int main(){
int x,y;
x=1; y=2; fun(x,&y); cout<
return 0;
}
运行后的输出结果是11,则横线处的语句应为
选项
A、int b
B、int *b
C、int &b
D、b
答案
B
解析
由于输出结果为11,所以函数fun的功能是将实参y的值修改为1。通过函数修改实参的值,只能通过引用或指针的方式,由函数调用fun(x, &y)可知形参为整型指针,即int *b,答案为B。
转载请注明原文地址:https://kaotiyun.com/show/yyNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
若有以下程序:#include<iostream>usingnamespacestd;classBase{public:Base(){x=0;}
假定用户没有给一个名为MyClass的类定义析构函数,则系统为其定义的默认析构函数首部形式为【】。
设一棵二叉树中有3个叶子结点,有8个度为1的结点,则该二叉树中总的结点数为【】。
下面程序的输出结果是#include<iostream,h>classexample{inta;public:example(intb){a=b++;}void
下面对于友元函数描述正确的是
按照“后进先出”原则组织数据的数据结构是
下列叙述中正确的是
有以下程序#include<iostream>usingnamespacestd;classMyClass{public:MyClass(intn){number=n;}
随机试题
简述组织文化的层次和内容。
当前我国注册咨询工程师(投资)执业应侧重于()咨询。
光驱的倍数越大()。
需要安置的农业人口的安置补偿费标准,最高不得超过被征收前3年平均年产值的()倍。
关于债权人委员会,下列说法不正确的是()。
我国首位获得诺贝尔生理学或医学奖的科学家是()。
设u=f(xy,x2-y2,x),其中函数f有二阶连续偏导数,试求:(Ⅰ)du;(Ⅱ)
Pricesarcsky-high,withprofitstomatch.Butlookingfurtherahead,theindustryfaceswrenchingchange,saysanexpertofen
SupposeyouareinvitedbyProfessorWilliamstogiveapresentationaboutChineseculturetoagroupofinternationalstudents.
HavingKidsMakesYouHappy?[A]WhenIwasgrowingup,ourformerneighbors,whomwe’llcalltheSloans,weretheonlycoupl
最新回复
(
0
)