fork download
  1. #include<stdio.h>
  2. int str_count(char *str,char C);
  3. int main(void){
  4. char str[20]="asdssfg";
  5. char x='s';
  6. int count =0;
  7.  
  8. count = str_count(str, x);
  9. printf("%d",count);
  10. return 0;
  11. }
  12. int str_count(char*str,char x){
  13. int count=0;
  14. while(*str){
  15. if(*str==x){
  16. count++;
  17. }
  18. str++;
  19. }
  20. }
Success #stdin #stdout 0s 5440KB
stdin
Standard input is empty
stdout
Standard output is empty