首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> int f( int x[], int n ) { if ( n> 1) return x[n-1]+ f(x, n-1)*10; else return x
有以下程序 #include <stdio.h> int f( int x[], int n ) { if ( n> 1) return x[n-1]+ f(x, n-1)*10; else return x
admin
2020-06-16
12
问题
有以下程序
#include <stdio.h>
int f( int x[], int n )
{ if ( n> 1)
return x[n-1]+ f(x, n-1)*10;
else
return x[0];
}
main( )
{ int z[3] = {1,2,3}, y;
y = f(z,3);
printf( "%d\n", y );
}
程序运行后的输出结果是
选项
A、321
B、123
C、1
D、3
答案
B
解析
f函数的作用是将int型数组构造成一个整型数。f函数采用递归的方式来实现,位数是递增的。有题设可知结果为123,因此输出结果为B选项
转载请注明原文地址:https://kaotiyun.com/show/Ss3p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
请编写一个函数fun,它的功能是:将ss所指字符串中所有下标为奇数位置的字母转换为大写(若该位置上不是字母,则不转换)。例如,若输入"abc4Efg",则应输出"aBc4EFg"。注意:部分源程序在文件PROGl.C中。请勿改动主函数ma
下列给定的程序中,函数fun的功能是:计算并输出k以内最大的10个能被13或17整除的自然数之和。k的值由主函数传入,若k的值为500,则函数的值为4622。请改正程序中的错误,使它能得出正确的结果。注意:部分源程序在文件MODll.C
读取二进制文件的函数调用形式为:fread(buffer,size,count,fp);,其中buffer代表的是()。
下列定义数组的语句中正确的是()。
有以下程序:#include<stdio.h>main(){inty=9;for(;y>0;y--)if(y%3==0)printf("%d",--y);}程序的运行结果是()。
在关系数据库设计中,关系模式设计属于()。
下列叙述中错误的是()。
以下选项中关于程序模块化的叙述错误的是()。
下列叙述中正确的是()。
使用VC++2010打开考生文件夹下modi1中的解决方案。此解决方案的项目中包含一个源程序文件modi1.c。在此程序中,函数fun的功能是:在字符串的最前端加入n个*号,形成新串,并且覆盖原串。字符串的长度最长允许为79。请改正程序中的错误,使它能
随机试题
在先秦时期的区域文化中,源于南楚的包括()
关于腺癌,下列哪项不正确
若在一个正弦(或非正弦)信号周期内取若干个点的值,取点的多少以能恢复原信号为依据,再将每个点的值用若干位二进制数码表示,这就是用数字量表示模拟量的方法。将模拟量转换为数字信号的介质为模/数转换器(ADC)。数字影像则是将模拟影像分解成有限个小区域,每个小区
位于山区基岩地下水单元补给区的I类一级评价项目,地下水环境现状调查范围应是()。
王某和张某是两个刚刚从事会计工作的年轻人,对相关财经法规不够熟悉.20X8年10月10日,王某向张某签发了一张16000元的转账支票以及一张1200元的现金支票,王某在签发支票时使用普通的蓝色水笔填写,并且没有签章。张某将16000元的转账支票交给银
两家以上商业银行受控于同一集团但又不以股权公司的形式出现的制度是()。
“行政”通常指执行国家意志、推行政务、管理社会公共事务的活动。在我国,这一活动的主体主要是()。
土家族的主要禁忌有()。
如图1所示,是甲、乙、丙三个物体的v-t图像,则下列说法正确的是()。
在ENIAC的研制过程中,由美籍匈牙利数学家总结并提出了非常重要的改进意见,他是
最新回复
(
0
)