#include <stdio.h>
#include <string.h>
int Palindrome(char mystr[], int len)
{
// base case: if the length of the string is 0 or 1, it is a palindrome
if (len <= 1)
return 1;
// check if the first and last characters are the same
if (mystr[0] != mystr[len - 1])
return 0;
// if the first and last characters are the same, check the substring that
// lies between them (excluding the first and last characters)
return Palindrome(mystr + 1, len - 2);
}
int main()
{
char mystr[] = "abcba";
int len = strlen(mystr);
if (Palindrome(mystr, len))
printf("Palindrome\n");
else
printf("Not palindrome\n");
return 0;
}
This function works by checking the first and last characters of the string. If they match, it calls itself with a substring that excludes the first and last characters. This process continues until the length of the string is 0 or 1, at which point it returns 1 (indicating that the string is a palindrome). If any of the characters do not match, the function returns 0 immediately.
read more about this at https://brainly.com/question/12567947
#SPJ4