The_Law

Untitled

Sep 24th, 2018
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <ctype.h>
  2.  
  3. int
  4. mystrspccmp(const char *str1, const char *str2)
  5. {
  6.     while (*str1 || *str2) {
  7.         while (isspace(*str1)) {
  8.             ++str1;
  9.         }
  10.         while (isspace(*str2)) {
  11.             ++str2;
  12.         }
  13.         if (*str1 != *str2) {
  14.             break;
  15.         }
  16.         if (!*str1) {
  17.             break;
  18.         }
  19.         ++str1;
  20.         ++str2;
  21.     }
  22.  
  23.     return (unsigned char) *str1 - (unsigned char) *str2;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment