问题 单项选择题

下列程序的运行结果为( )。 群include<stdio.h> void abc(char*str) {int a,b,i,j; for(i=0;str[i]!=’\0;i++) if(str[i]!==:’a’) str[j++]=str[i]; str[j]=’\0’; } void main() {char str[]="abcdef"; abc(str); printf("str[]=%s",str); }

答案

参考答案:A

解析: 本题考查函数调用是的参数传递。通过函数abc的执行,将字符串中的字母a去掉,保留剩下的,由于是通过指针调用,所以改变字符串的结果。

选择题
判断题