fork download
  1. #include <iostream>
  2.  
  3. int mystrcmp(const char *s1, const char *s2) // strcmp function
  4. {
  5. while(*s1 == *s2)
  6. {
  7. if(*s1 == '\0' || *s2 == '\0')
  8. break;
  9.  
  10. s1++;
  11. s2++;
  12. }
  13.  
  14. if(*s1 == '\0' && *s2 == '\0')
  15. return (0);
  16. else
  17. return (-1);
  18. }
  19.  
  20. int main() {
  21. std::cout << mystrcmp("","") << std::endl;
  22. return 0;
  23. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
0