fork download
  1. # include <stdio.h>
  2.  
  3. int myStrcmp(char s[], char t[]){
  4. int i;
  5. for(i=0; s[i]==t[i]; i++){ //文字列が一致している間は繰り返す
  6. if(s[i] == '/0') //for文の条件よりsが終端文字であれば一致しているといえる
  7. return 1;
  8. }
  9. return 0; //異なった場合はoを返す
  10. }
  11.  
  12. int main(){
  13. int ans;
  14. char s[100];
  15. char t[100];
  16. scanf("%s %s",s,t);
  17. ans = myStrcmp(s,t);
  18. printf("%s = %s -> %d\n",s,t,ans);
  19. return 0;
  20. }
Success #stdin #stdout 0s 5296KB
stdin
3
stdout
3 =  -> 0