首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的运行结果为 #include<iostream,h> Void swap(int &a,int b) { int temp; temp=a++; a=
下面程序的运行结果为 #include<iostream,h> Void swap(int &a,int b) { int temp; temp=a++; a=
admin
2010-03-29
39
问题
下面程序的运行结果为 #include<iostream,h> Void swap(int &a,int b) { int temp; temp=a++; a=b; b=temp; } void main() { int a=2,b=3; swap(a,b); cout <<a <<”,” <<b <<end1 }
选项
A、2,3
B、3,2
C、2,2
D、3,3
答案
8
解析
本题考查的是引用调用,因为函数swap引用调用参数a,所以在swap函数中a的变化会改变主函数中9的值,即a自加1,但b的值并未改变。
转载请注明原文地址:https://kaotiyun.com/show/bmjp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
以下结构体说明和变量定义中,正确的是
有以下程序#includevoidmain(){chars[]={"012xy"};inti,n=0;for(i=0;s[i]!=0;i++)if(s[i]>=’a’&&s[i]
有以下程序,执行后的结果是#include<stdio.h>main(){chars[]="abcde";s+=2;printf("%d\n",s[0]);}
以下叙述中正确的是
有以下程序#includevoidfun(char*p,intn){charb[6]="abcde";inti;for(i=0,p=b;i<n;i++)p[i]=b[i];}main(){char
在数据库管理系统提供的数据语言中,负责数据的查询、增加、删除和修改等操作的是
数据库技术的根本目标是要解决数据的()。
有以下程序structS{inta;intb;};main(){structSa,*p=&a;a.a=99;printf("%d\n",___________);}程序要求输出结构体中成员a的数据
数据库管理系统(DBMS)是
有以下函数:intfun(char*x,char*y){intn=0;while((*x==*y)&&*x!=’\0’){x++;y++;n++:}returnn:}函数的功能是()。
随机试题
认为人都有恻隐之心、羞恶之心、恭敬之心、是非之心,这是______的观点()
20世纪以来,全球化成为了主要话题。材料一现代世界的南北分裂、贫富悬殊。在1500年之后的几个世纪中,世界市场逐渐形成。但是对于亚非拉国家而言,正如一个埃及记者所说:已经陷入了重围……
下雨时,行人应避开灯杆、电线杆、变压器及附近的树木等有可能连电的物体。()
经济特区
TodaytheofficiallanguageoftheUnitedStatesandmostofCanadaisEnglish.However,Frenchalmostbecametheofficiallangu
Itseemstomethatneighborsaregoing【B1】______inAmerica.Thefriendnextdoorfromwhomyouborrowedfoureggsoraladderh
A、ThewomancantellJoanwhensheseesheratnoon.B、ThewomanshouldtellJoan’sbrotheraboutthereception.C、Thewomanmus
A、HebelievesthatFrankisjoking.B、HebelievesthatFrankwillquithisjob.C、Heagreeswiththewoman.D、HebelievesthatF
A、Itisfavorabletoknowledgeaccumulation.B、Itisbeneficialtoindependentchildren.C、Itisunhealthytostudents’upbringi
Skipthatthirdhelpingofroastbeef,savetheplanetanddoyourheartafavoratthesametime.That’stheadviceofAlan
最新回复
(
0
)