首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的运行结果是( )。 #include<stdio.h> voidfun(int*s,int*p) { static int t=3; *p=s[t]; t--; } void main()
下列程序的运行结果是( )。 #include<stdio.h> voidfun(int*s,int*p) { static int t=3; *p=s[t]; t--; } void main()
admin
2013-02-23
15
问题
下列程序的运行结果是( )。
#include<stdio.h>
voidfun(int*s,int*p)
{ static int t=3;
*p=s[t];
t--;
}
void main()
{ int a[]={2,3,4,5},k;
int x;
for(k=0;k<4;k++)
{ fun(a,&x);
printf("%d,",x);
}
}
选项
A、5,4,3,2
B、2,3,4,5,
C、2,2,2,2,
D、5,5,5,5,
答案
A
解析
分析fun函数程序段,可知fun函数要实现的功能是将s中第(t+1)个元素以前的元素逆置赋给数组p。由于fun中函数定义了静态变量t=3,因此,在主函数中调用函数fun(a,&x)时,就是要将数组a中前4个元素逆置赋给数组x,最后输出x数组。
转载请注明原文地址:https://jikaoti.com/ti/XjB0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
若已建立如下图所示的单向链表结构:在该链表结构中,指针p、s分别指向图中所示结点,则不能将s所指的结点插入到链表末尾仍构成单向链表的语句组是______。
下列循环的循环次数是______。intk=2;while(k=0)printf["%d",k);k--;printf("\n");
函数fun的功能是:根据以下公式求p的值,结果由函数值返回。m与n为两个正数,且要求m>n。例如:m=12,n=8时,运行结果应该是495.000000。请在题目的空白处填写适当的程序语句,将该程序补充完整。#include<s
在C程序中,可将整型数以二进制形式存放到文件中的函数是______。
以下定义的结构体类型拟包含两个成员,其中成员变量info用来存入整形数据;成员变量link是指向自身结构体的指针,请将定义补充完整。structnode{intinfo;______link;}
对于长度为n的线性表,在最坏情况下,下列各排序法所对应的比较次数中正确的是 ______。
结构化程序设计的一种基本方法是()
下面函数的功能是将指针t2所指向的线性链表,链接到t1所指向的链表的末端。假定t1所指向的链表非空structnode{floatx;structnode*next;};connect(structnode*t1,structno
常用的软件结构设计工具是结构图(SC),也称程序结构图。其中,用矩形表示______,用带空心圆的箭头表示传递的是数据。
随机试题
为了弥补陶瓷材料抗弯强度低、性脆和抗冲击性能差的缺点,陶瓷刀片切削刃常刃磨出20°的(),而且刀片的厚度和刀尖圆弧也比同一尺寸的硬质合金刀片略大些。
某患者因剧烈腹痛到乡卫生院就诊,因医生诊断、治疗错误,造成该患者功能障碍,经县医疗事故鉴定委员会鉴定为“三级医疗事故"。其家属对鉴定结论持有异议,认为应属“二级医疗事故"。该事故进一步处理解决的正确程序是()
Colles骨折远端的典型移位是
以下心包炎患者的自我表述提示饮食教育需加强的是
房地产的()是房地产投资最重要的一个特性。房地产不能脱离周围的环境而单独存在,就是强调了位置对房地产投资的一个重要性。
成本管理就是要在保证工期和质量满足要求的情况下,采取相应管理措施,把成本控制在计划范围内,并进一步寻求最大程度的成本节约。成本管理的任务不包括()。
公司出纳因轮换岗位需要办理工作交接,则交接过程中应由()负责监交。
10年前,张昆与前妻离婚,当时15岁的女儿张欣表示与母亲共同生活,张昆则将家里全部财产包括一套两室户住房和2万元存款都留给了前妻和女儿。离婚后次年,张昆从原单位辞职下海经商,并与林丽结婚。3年后,林丽生下儿子张言并辞去工作,待在家里操持家务和照顾儿子。又过
从新世纪以来,特别是过去五年来中国大陆电影创作来看,称得上具备现实主义范式内涵的影片呈现出多种不同的复杂情况。从被刻画的当代社会现实的平常层面到奇崛层面的逻辑结构去归纳,可看到如下三个层面:一是回到个体日常生活流,二是个体日常生活困境及其诗意抚慰.三是社会
FoodInflationKeptHiddeninTinierBagsChipsaredisappearingfrombags,candyfromboxesandvegetablesfromcans.A
最新回复
(
0
)