#include <iostream>using namespace std; int count(char* str,char chr){ if (*str==0) return 0; if(*str==chr) return 1+count(str+1,chr); else return 0+count(str+1,chr);}int main() { char *a='12345'; char b='1'; cout<<count(a,b); // your code goes here return 0;}
Standard input is empty
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]
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!