首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #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
2016-12-28
17
问题
有以下程序
#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/rwDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
当变量c的值不为2、4、6时,值也为"真"的表达式是
有以下程序intfun1(doublea){returna*=a;}intfun2(doublex,doubley){doublea=0,b=0;a=fun1(x);b=fun1(y);return(int)(
下列选项中C语言中不合法的字符串常量的是
以下程序的输出结果是longfun(intn){longs;if(n==1‖n==2)s=2;elses=n-fun(n-1);returns;}main(){printf("%1d\n"
有以下语句,则对a数组元素的引用不正确的是inta[10]={0,1,2,3,4,5,6,7,8,9},*p=a;
下列关于单目运算符++,--的叙述中正确的是
下面的程序实现的是从指针p所指向的地址的n个数中,找出最大的和最小的数据,请填空。fun(int*p,intn){int*q;intmax,min;max=min=*p;for(q=p;______;q++)if(*q>max
若有下列说明和语句,则对结构体变量st中成员i的引用方式不正确的是()。Structstu{inti;intname;}st,*p;p=&st;
以下程序中函数f的功能是在数组x的n个数(假定n个数互不相同)中找出最大最小数,将其中最小的数与第一个数对换,把最大的数与最后一个数对换。请填空。#include<stdio.h>voidf(intx[],intn){intp0,p1,i
随机试题
Whatarethespeakersmainlydiscussing?
老年性白内障虹膜投影阳性,见于白内障哪一期
二尖瓣狭窄主动脉瓣狭窄
下列关于导赤散的药物功用,叙述不正确的是()。
下列情况应征消费税的有()。
在单元格中输入公式“=SUM(B2:B3,D2:E2)”时,其功能是()。
国际收支包括经常项目和资本项目,一国国际收支顺差过大,会导致
Laurawantstositbythewindow.
A、Thetwelfth.B、Thethirteenth.C、Thefourteenth.D、Thefifteenth.A男士说,根据记录,女士预订的房间是13号,但女士马上纠正,订的是今晚,不是明晚。由此可以推断今天是12号,是女士预订的
A、Theprogramissatisfactory.B、Theprogramisdisappointing.C、Theprogramiscancelled.D、Theprogramisbetterthanexpected
最新回复
(
0
)