fork download
  1. #include <stdio.h>
  2.  
  3. int strlen(char *s){
  4. char *p = s;
  5. while(*p != '\0') p++;
  6. return p - s;
  7. }
  8.  
  9. void strcpy(char *s, char *t){
  10. while(*s++ = *t++)
  11. ;
  12. }
  13.  
  14. int strcmp(char *s, char *t){
  15. while(*s == *t){
  16. printf("%c, %c\n", *s, *t);
  17. if(*s == '\0')
  18. return 0;
  19. ++s;
  20. ++t;
  21. }
  22. return *s - *t;
  23. }
  24.  
  25. int main(){
  26. int p;
  27. char s[5] = "hooy";
  28. char t[5];
  29. char *r = "hooz";
  30.  
  31. printf("%d\n", strcmp(s, r));
  32.  
  33. scanf("%d", &p);
  34. return 0;
  35. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
h, h
o, o
o, o
-1