fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int count(char* str,char chr)
  5. {
  6. if (*str==0)
  7. return 0;
  8. if(*str==chr)
  9. return 1+count(str+1,chr);
  10. else
  11. return 0+count(str+1,chr);
  12. }
  13. int main() {
  14. char *a='12345';
  15. char b='1';
  16. cout<<count(a,b);
  17. // your code goes here
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:14:10: warning: character constant too long for its type
  char *a='12345';
          ^
prog.cpp: In function 'int main()':
prog.cpp:14:10: error: invalid conversion from 'int' to 'char*' [-fpermissive]
stdout
Standard output is empty