填空题 C语言
题号 #149476

下列程序的功能是:求出ss所指字符串中指定字符的个数,并返回此值。 
例如,若输入字符串123412132,输入字符1,则输出3,请填空。 
#include  
#include  
#define M 81 
int fun(char *ss, char c) 
{ int i=0; 
for(; ( );ss++) 
if(*ss==c)i++; 
return i;} 
main() 
{ char a[M], ch; 
clrscr(); 
printf("\nPlease enter a string: "); gets(a); 
printf("\nPlease enter a char: "); ch=getchar(); 
printf("\nThe number of the char is: %d\n", fun(a,ch));}

进入在线模考

参考答案

暂无

答案解析

*ss!= '\0'

你可能感兴趣的试题

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