Advertisement
dashaSk

second

Sep 16th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. int mystrspccmp(const char *str1, const char *str2) {
  5.     const char *s1 = str1, *s2 = str2;
  6.     while (isspace (*s1)) {
  7.         ++s1;
  8.     }
  9.     while (isspace (*s2)) {
  10.         ++s2;
  11.     }
  12.     while (*s1 == *s2 && *s1) {
  13.         ++s1;
  14.         ++s2;
  15.         while (isspace (*s1)) {
  16.             ++s1;
  17.         }
  18.         while (isspace (*s2)) {
  19.             ++s2;
  20.         }
  21.     }
  22.     return (unsigned)*s1 - (unsigned)*s2;
  23. }
  24.  
  25. int
  26. main(void) {
  27.     char *s = "ubuijb", *t = "d";
  28.     printf("%d", mystrspccmp(s, t));
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement