請編寫一個(gè)函數(shù)int func(char *str,char ch),它的功能是:求出str字符串中指定字符ch的個(gè)數(shù),并返回此值,c語言程序
1 回答

侃侃無極
TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個(gè)贊
int func(char *str,char ch)
{
int cnt;
for(cnt=0;*str;str++)
if(*str==ch)cnt++;
return cnt;
}
- 1 回答
- 0 關(guān)注
- 162 瀏覽
添加回答
舉報(bào)
0/150
提交
取消