首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的运行结果是( )。 #include<stdio.h> void fun(int*s,int*p) {static int t=3; *p=s[t]; t--; } void main() {
下列程序的运行结果是( )。 #include<stdio.h> void fun(int*s,int*p) {static int t=3; *p=s[t]; t--; } void main() {
admin
2011-06-10
18
问题
下列程序的运行结果是( )。 #include<stdio.h> void fun(int*s,int*p) {static int t=3; *p=s[t]; t--; } void main() {int a[]={2,3,4,5},k,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://kaotiyun.com/show/HRPp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
若有语句 inti=-19,j=i%4; printf("%d\n",j); 则输出的结果是【】。
假设在当前盘当前目录下有一个可执行程序USER.EXE。现要执行该程序,并要求在执行过程中将显示输出的结果信息存入当前盘当前目录的文件OUT.DAT中,则完整的DOS命令为【 】。
有以下程序 main( ) { char *s[ ]={"one","two","three"},*p; p=s[1]; printf("%c,%s\n",*(p+1),s[0]); } 执行后输出结果是
若有一些定义和语句 #include <stdio.h> int a=4,b=3,*p,*q,*w; p=&a; q=&b; w=q; q=NULL; 则以下选项中错误的语句是
在Windows环境下,若要将整个屏幕上显示的内容存入剪贴板,可以按
有以下语句段 int n1=10,n2=20; printf(“【】”,n1.n2); 要求按以下格式输出n1和n2的值,每个输出行从第一列开始,请填空。 n1=10 n2=20
下列选项中,不能用作标识符的是
若变量已正确定义,要求程序段完成求5!的计算,不能完成此操作的程序段是()。
若进栈序列为1,2,3,4,进栈过程中可以出栈,则下列不可能的一个出栈序列是______。
以下程序中函数f的功能是将n个字符串按由大到小的顺序进行排序。#include<string.h>voidf(charp[][10],intn){chart[20];inti,j;for(i=
随机试题
行政复议机关责令被申请人重新作出具体行政行为,法律、法规、规章未规定期限的,重新作出具体行政行为的期限为30日()
个人生命周期中维持期的主要特征有()。Ⅰ.对应年龄为45~54岁Ⅱ.家庭形态表现为子女上小学、中学Ⅲ.主要理财活动为收入增加、筹退休金Ⅳ.保险计划为养老险、投资型保险
把下列汉语合成词中所有的语素提取出来,分别填入A、B、C、D四项中:飞机,笑,呵呵,科学,家,老虎A.自由语素:_______B.黏着语素:_______C.实义语素:_______D.虚义语素:_______
国家海洋环境质量标准,由____制定。
急性糜烂性胃炎的发病原因主要是
经营者提供商品或服务造成消费者或者其他受害人死亡的,应当支付
基金经理在基金投资中的作用是()。
根据企业所得税法律制度的规定,企业发生的下列税金中,在计算企业所得税应纳税所得额时可以扣除的有()。
阀控式铅酸蓄电池的正极活性物质为(1),负极活性物质为(2)。
屠美如对儿童绘画分期不同于陈鹤琴的一项是()
最新回复
(
0
)