首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include int fun(char*s){ char*p=s; while(*p!=0)p++; return(p-s);} main(){ printf("%d\n",fun
有以下程序 #include int fun(char*s){ char*p=s; while(*p!=0)p++; return(p-s);} main(){ printf("%d\n",fun
admin
2020-05-19
12
问题
有以下程序
#include
int fun(char*s){
char*p=s;
while(*p!=0)p++;
return(p-s);}
main(){
printf("%d\n",fun("goodbey!"));}
程序的输出结果是
选项
A、6
B、8
C、0
D、7
答案
B
解析
函数fun的主要功能是计算字符串中实际字符的个数,因此"goodbey!"含有字符为8,返回值为8。
转载请注明原文地址:https://kaotiyun.com/show/myCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列给定程序中函数fun的功能是:求两个非零正整数的最大公约数,并作为函数值返回。例如,若numl和num2分别为49和2l,则输出的最大公约数为7;若numl和hum2分别为27和81,则输出的最大公约数为27。请改正程序中的错误,使它能得出
下列给定程序中函数fun的功能是:用递归算法计算斐波拉契数列中第n项的值。从第1项起,斐波拉契数列为:1,1,2,3,5,8,13,21,…例如,若给n输入7,则该项的斐波拉契数值为13。请改正程序中的错误,使它能得出正确结果。
下列给定程序中,函数fun的功能是:先将字符串s中的字符按正序存放到字符串t中,然后把s中的字符按逆序连接到字符串t的后面。例如,当s中的字符串为“ABCDE”时,则t中的字符串应为“ABCDEEDCBA”。请改正程序中的错误,使它能得
请编写函数fun,其功能是:找出一维整型数组元素中最大的值及其所在的下标,并通过形参传回。数组元素中的值已在主函数中赋予。主函数中x是数组名,n是x中的数据个数,max存放最大值,index存放最大值所在元素的下标。注意:部分源程序给出
下列给定程序中函数fun的功能是:判断一个整数是否为素数,若是素数返回l,否则返回0。在main函数中,若fun返回1输出YES,若fun返回0输出NO!。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,
编写函数fun,它的功能是:求小于形参n同时能被3与7整除的所有自然数之和的平方根,并作为函数值返回。例如,若n为1000时,程序输出应为:s=153.909064。注意:部分源程序在文件PROG1.c中。请勿改动主函数mai
给定程序中,函数fun的功能是:将a所指3×5矩阵中第k列的元素左移到第0列,第k列以后的每列元素行依次左移,原来左边的各列依次绕到右边。例如,有下列矩阵:12345123
随机试题
用筛选法可得到2~n(n
下列关于赛庚啶说法不正确的是
指出背景材料中的不妥之处,并改正。项目质量计划包括的内容有哪些?
某增值税一般纳税人自建仓库一幢,购入工程物资200万元,增值税额为32万元,已全部用于建造仓库;耗用库存材料50万元,应负担的增值税额为8万元;支付建筑工人工资36万元。该仓库建造完成并达到预定可使用状态,其入账价值为()万元。
我国文物划分为不同级别的依据是文物的历史、科学与文化价值。()
有学者探究道光皇帝为什么把他的墓修筑得比其他帝王墓都要矮小。北京师范大学历史学院龚书铎教授说:“是因为‘在他手上打了败仗丢了土地,没有面目见先帝。”这里所说的“土地”是指()。
班级管理的实质是让每个学生成为班级的主人。()
设=e3,其中f(χ)连续,求.
depressed记者想给她拍照,无非是想拍到她沮丧的表情,因此她固守着不让人进来。此题完全可以通过阅读题目猜出,一个女人离婚了,闭门不出,不是伤心就是沮丧。注意不能写成depressing。
Therearemany______toconsiderwhenassessingemploymentchoices.Whilesalaryisofcriticalimportance,thereareavarietyo
最新回复
(
0
)