下面程序的输出结果是()。#include "string.h"fun(char*w int n){ char t *s1 *s2;s1=w; s2=w+n-
程序
已帮助 人
下面程序的输出结果是()。#include "string.h"fun(char*w,int n){ char t,*s1,*s2;s1=w; s2=w+n-1;while(s1<s2){ t=*s1++;*s1=*s2--;*s2=t;}}main(){ static char p[]="1234567";fun(p,strlen(p));printf("%s",p);}A.7654321 B.1717171 C.7171717 D.1711717
-
参考答案:D函数的功能是将数组的元素交换,首先s1=p,即s1指向1,s2=p+7-1,即s2指向7,t=*s1++,将1赋给t,然后s1指向2,*s1=*s2++,将7赋给s1,即原来2的位置,s2指向6,然后*s2=t,将1赋给*s2即原来6的位置,…….
