单选题
C语言
题号 #1556692
有以下函数
int fun(char *x,char *y)
{int n=0;
while((*x=*y)&&*x!='\0'){x++;y++;n++;}
return n:
)
函数的功能是( )。
参考答案
B
答案解析
在while循环中的判断表达式为(*x==*y)&&*x!='\0',所以只要字符串x与y的当前字符不相等时,循环就结束。
你可能感兴趣的试题
A.if(strcmp(s1,s2)=0)puts(s1);
B.if(strcmp(s1,s2)!=0) puts(s2);
C.if(strcmp(s1,s2)=1)puts(s1,);
D.if(strcmp(s1,s2)!=0) puts(s1);
A.double fun(double a[15])
B.double fun(double *a)
C.double fun(double a[])
D.double fun(double a)