填空题
请补充函数proc(),该函数的功能是:返回字符数组中指定字符的个数,指定字符从键盘输入。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#define M 80
int proc(char str[], char ch)
{
int i=0, n=0;
while(
1)
{
if(
2)
n++;
i++;
}
3;
}
void main()
{
int n;
char str[M], ch;
system("CLS");
printf("/nlnput a string: /n");
gets(str);
printf("/nInput a charactor: /n");
scanf("%c", &ch);
n=proc(str, ch);
printf("/nnumber of %c: %d", ch, n);
}