首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include<stdio.h> void f(int*p,int*q); main() {int m=1,n=2,*r=&m; f(r,&n);printf("%d,%d",m,n); void f(int*p,int*q) { p=p+1
有以下程序 #include<stdio.h> void f(int*p,int*q); main() {int m=1,n=2,*r=&m; f(r,&n);printf("%d,%d",m,n); void f(int*p,int*q) { p=p+1
admin
2018-11-21
22
问题
有以下程序
#include<stdio.h>
void f(int*p,int*q);
main()
{int m=1,n=2,*r=&m;
f(r,&n);printf("%d,%d",m,n);
void f(int*p,int*q)
{
p=p+1;*q=*q+1;
}
程序运行后的输出结果是
选项
A、2,3
B、1,3
C、1,4
D、1,2
答案
B
解析
本题考查函数的调用与指针。fun()函数的作用是:使指针p指向原来所指变量的下一个变量,使q指针指向的值加1。主函数中,指针r指向m,调用fun()函数的结果是,使r指向地址位于m后面的变量,使位于n的地址上的变量(就是n)的值加1,因此,结果为1,3。
转载请注明原文地址:https://kaotiyun.com/show/nlxp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序#include<stdio.h>main(){intc;while((c=getchar())!=’\n’){switch(c-’2’){caseO:case1:putchar(
以下叙述中不正确的是()。
两个或两个以上模块之间关联的紧密程度称为()。
以下程序段打开文件后,先利用fseek函数将文件位置指针定位在文件末尾,然后调用ftell函数返回当前文件位置指针的具体位置,从而确定文件长度。请填空。FILE*myf;longf1;myf=【】("test.t","rb")
下列程序的输出结果是______。#include<stdio.h>main(){intx=10,y=10,i;for(i=0;x>8;y=++i)printf("%d%d",x--,y);}
下述程序的输出结果是#includevoidmain(){inta[5]={2,4,6,8,10};int*p=a,**q=&p;printf("%d,",*(p++));printf("%d",**q);}
以下程序段中的变量已正确定义for(=0;i<4;i++,i++)for(k=1;k<3;k++);printf("*")程序段的输出结果是______。
以下函数用来求出2个整数之和,并通过形参将结果传回。voidfunc(intx,inty,【】z){*z=x+y;}
关系表达式x<y<z,用C语言的表达式为【】。
若有程序:main(){inti,j;scanq("i=%d,j=%d",&i,&j);printf("i=%d,j=%d\n",i,j);}要求给i赋10,给j赋20,则应该从键盘输入【
随机试题
A.like-mindedpeoplecangettogetherB.divorceratehasbeenontheincreaseC.whatloveandcommitmentreallymeanstothe
心肺脑后期复苏过程中,对于脑复苏最重要的措施是()
A.测定肺毛细血管楔嵌压B.测定肺动脉压C.测定中心静脉压D.测定主动脉与左心室压力差梯度E.测量四肢动脉压对急性心肌梗死患者,诊断是否存在左心室衰竭
A.去枕平卧,头偏向一侧B.侧卧位C.半卧位D.去枕平卧6~8hE.头高斜坡位胃大部切除术后()。
室间隔缺损患儿在剧烈哭闹屏气时,可出现暂时性青紫的原因是
资产负债管理长期目标可概括为:从银行整体战略出发,建立符合现代商业银行要求的资产负债管理体系,强化资本约束,提高风险控制水平,加强业务经营引导和调控能力,实现()最大化,进而持续提升股东价值回报。
某牧民饲养公羊和母羊共140只,一次共剪羊毛160斤。若每只公羊平均剪毛1斤2两,每只母羊平均剪毛8两,问公羊比母羊多多少只?
1,12,35,70,117,()
[2013年1月]某工厂生产一批零件,计划10天完成任务,实际提前两天完成,则每天的产量比计划平均提高了()。
Birdsthatareliterallyhalfasleep—withonebrainhemispherealertandtheothersleeping—controlwhichsideofthebrain
最新回复
(
0
)