fork download
  1. # include <stdio.h>
  2.  
  3. int myStrcmp(char s[], char t[]){
  4. int i=0,j=0,k=0;
  5. while(s[i] != '\0'){
  6. i++;
  7. }
  8. while(t[j] != '\0'){
  9. j++;
  10. }
  11. if(i!=j) return 0;
  12. else{
  13. while(s[k] == t[k]){
  14. k++;
  15. if(s[k] == '\0') return 1;
  16. }
  17. }
  18. return 0;
  19. }
  20.  
  21. int main(){
  22. int ans;
  23. char s[100];
  24. char t[100];
  25. scanf("%s %s",s,t);
  26. ans = myStrcmp(s,t);
  27. printf("%s = %s -> %d\n",s,t,ans);
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0.01s 5320KB
stdin
abcd
abcd
stdout
abcd = abcd -> 1