Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. int isPalindrome(char *str, int len)
  2. {
  3.     int i = 0, j = len -1;
  4.     while (i <= j)
  5.     {
  6.         if (str[i] == ' ')
  7.         {
  8.             i++;
  9.             continue;
  10.         }
  11.  
  12.         if (str[j] == ' ')
  13.         {
  14.             j--;
  15.             continue;
  16.         }
  17.  
  18.         if (str[i] != str[j]) return 0;
  19.         i++;
  20.         j--;
  21.     }
  22.  
  23.     return 1;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement