单选题 C语言
题号 #2253802


下面程序的运行结果是(    )。
#inelude<stdio.h>
void del(char*s)
{  int i,j;
char*a;
a=s:
for(i=0,j=0;a[i]!='\0';i++)
{  if(a[i]>='0'&&a[i]<='9')
{s[j]=a[i];
j++;
}
s[j]='\0';
}
}
main()
{  char*s="aa89gggh";
del(s):
printf("\n%s",s);
}

进入在线模考

参考答案

D

答案解析


本题中del(char*s)函数实现的功能是:逐个读入S数组中的字符,如果遇到数字,则将数字存在s 中,遇到非数字字符则跳过。所以最后输出的应该是字符串S中所有的数字的个数。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考