首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include<stdio.h> #include<string.h> void fun(char*w,int m) {char s,*p1,*p2; p1=w;p2=w+m-1; wh
有以下程序 #include<stdio.h> #include<string.h> void fun(char*w,int m) {char s,*p1,*p2; p1=w;p2=w+m-1; wh
admin
2020-11-23
28
问题
有以下程序
#include<stdio.h>
#include<string.h>
void fun(char*w,int m)
{char s,*p1,*p2;
p1=w;p2=w+m-1;
while(p1<p2){s=*p1;*p1=*p2;*p2=s;p1++;p2--;}}
main()
{char a[]="123456";
fun(a,strlen(a));puts(a);}
选项
A、116611
B、161616
C、654321
D、123456
答案
C
解析
函数fun的功能是将字符串w中的元素从大到小进行排列,所以在主函数中调用函数fun后,字符串a的元素从大到小进行了排列。
转载请注明原文地址:https://kaotiyun.com/show/T53p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
在下列定义语句中,编译时会出现编译错误的是()。
以下选项中,能用作用户标识符的是()。
以下关于C语言的叙述中正确的是()。
有以下程序:#include<stdio.h>intfun(intx,inty){if(x!=y)return((x+y)/2);elsereturn(x);}main(
以下叙述正确的是()。
下列数据结构中,属于非线性结构的是()。
给定程序中,函数fun的功能足建立一个N×N的矩阵。矩阵元素的构成规律是:最外层元素的值全部为1;从外向内第2层元素的值全部为2;第3层元素的值全部为3,……依此类推。例如,若N=5,生成的矩阵为:11111
给定程序的主函数中,已给出由结构体构成的链表结点a、b、c,各结点的数据域中均存入字符,函数fun()的作用是:将a、b、c三个结点链接成一个单向链表,并输出链表结点中的数据。请在程序的下画线处填入正确的内容并把下画线删除,使程序得出正确的结果。注意:
C语言程序的模块化通过以下哪个选项来实现
C语言程序中,运算对象必须是整型数的运算符是
随机试题
奉国寺是我国最大的单层木架建筑,它的位置和始建年代分别是()。
A.胃泌素B.促胰液素C.胆囊收缩素D.血管活性肠肽E.乙酰胆碱主要引起胰腺分泌大量水分和碳酸氢盐的激素是
代谢蔗糖能力最强的细菌是
1岁患儿,发热5天,体温39℃,流涕,咳嗽重。皮肤出现红色斑丘疹,体温升至40℃。颊黏膜粗糙,可见白色斑点,合并肺炎。患儿需隔离至出疹后
隐匿或者故意销毁依法应当保存的会计凭证、会计账簿、财务会计报告。情节严重的,处( )年以下有期徒刑或者拘役,并处或者单处2万元以上20万元以下罚金。
下列不属于写字楼管理策略中合同服务与超值服务区别的是()。
全陪导游员小李带领一个广东旅游团到北京、内蒙古旅游,小李在陪同该团旅游过程中的主要工作首先是()。
教师职业劳动是一种以培养人为中心的精神生产,而不是创造产品的物质生产。()
下列关于1930年《中华民国民法》立法特点的表述,正确的有()。(2013年多选63)
结构化程序设计主要强调的是()。
最新回复
(
0
)