Advertisement
rafikamal

Palindrome Checking

Jan 28th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void checkPalindrome(char s[], int start, int end);
  5.  
  6. int main()
  7. {
  8.     char s[] = "ABBAB";
  9.     checkPalindrome(s, 0, strlen(s) - 1);
  10.    
  11.     return 0;
  12. }
  13.  
  14. void checkPalindrome(char s[], int start, int end)
  15. {
  16.     if(start > end)
  17.         printf("Palindrome");
  18.     else
  19.     {
  20.         if(s[start] == s[end])
  21.             checkPalindrome(s, start+1, end-1);
  22.         else
  23.             printf("Not palindrome");
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement