A-A+

有以下程序 include<stdio.h> include<string_h> voidf

2022-08-12 18:53:14 问答库 阅读 197 次

问题详情

有以下程序 include<stdio.h> include<string_h> voidfun(char*W,intm) {chars,*p1,*p2; p1=w;p2=w+m-1; while(pl<p2){s=*p1;*p1=*p2;*p2=s;p1++;p2-;} } main() {1chara[]=“123456“; fun(a,strlen(a));puts(a); }
A.116611
B.161616
C.65432l
D.123456

请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:C
函数fun的功能是将字符串w中的元素从大到小进行排列,所以在主函数中调用函数fun后,字符串a的元素从大到小进行了排列。

考点:程序