fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. const char* my_strchr(const char *place_to_find, char what_to_find)
  6. {
  7. for(int i=0;place_to_find[i];i++)
  8. if(what_to_find==place_to_find[i]) return place_to_find+i;
  9. return NULL;
  10. }
  11. int main()
  12. {
  13. const char *vocals1="AEIOUaeiou";
  14. char vocals2[]="AEIOUaeiou";
  15. cout<<strchr(vocals1,'e') << endl;
  16. cout<<strchr(vocals2,'e') << endl;
  17. cout<<my_strchr(vocals1,'e') << endl;
  18. cout<<my_strchr(vocals2,'e') << endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
eiou
eiou
eiou
eiou