fork(3) 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. }
  20. return *s - *t;
  21. }
  22.  
  23. int main(){
  24. int p;
  25. char s[5] = "hooy";
  26. char t[5];
  27. char *r = "hooz";
  28.  
  29. printf("%d\n", strcmp(s, r));
  30.  
  31. scanf("%d", &p);
  32. return 0;
  33. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
�, y
�, z
�, {
0