Palindrome Checking

How to write a C program to Plaindrome Checking in C programmng ?


Solution:
/*C program to plaindrome checking*/
#include <stdio.h>
#include <string.h>

void checkPalindrome(char s[], int start, int end);

int main()
{
char s[] = "ABBAB";
checkPalindrome(s, 0, strlen(s) - 1);

return 0;
}

void checkPalindrome(char s[], int start, int end)
{
if(start > end)
printf("Palindrome");
else
{
if(s[start] == s[end])
checkPalindrome(s, start+1, end-1);
else
printf("Not palindrome");
}
}


Learn More :