c语言 11-5
1、
#include <stdio.h> int count(const char *s, int key) { int j = 0; while(*s) { if(*s == key) j++; s++; } return j; } int main(void) { char str[128]; printf("str: "); scanf("%s", str); printf("the number: %d\n", count(str, 'c')); return 0; }