fork download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. int stricmp(char const *s1, char const *s2) {
  5. while (1) {
  6. int res = tolower(*s1) - tolower(*s2);
  7. if (res != 0 || !*s1) return res;
  8. s1++;
  9. s2++;
  10. }
  11. }
  12.  
  13. int main(void) {
  14. printf("%d\n", stricmp("aaa", "AAA"));
  15. printf("%d\n", stricmp("aaa", "aaa"));
  16. printf("%d\n", stricmp("aaa", "AAB"));
  17. printf("%d\n", stricmp("abb", "AAB"));
  18. }
  19.  
  20. //https://pt.stackoverflow.com/q/251861/101
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
0
0
-1
1