#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int checkpalindrome(char* a,int n);
int main()
{
char *a;
int i,n;
printf("Enter the size of the string but should be odd => ");
scanf("%d",&n);
a=(char*)calloc(n,sizeof(char));
for(i=0;i<n;i++)
{
if(i==(n-1)/2)
{ printf("Enter X\n");}
scanf("%c",&a[i]);
}
if(checkpalindrome(a,n)){
printf("\nstring is palindrome");
}
else{
printf("\nstring is not a palindrome");
}
return 0;
}
int checkpalindrome(char *a,int n)
{
int i;
for(i=0;i<n;i++)
{
if(a[i]==a[n-i])
continue;
else
return 0;
}
return 1;
}
проверьте этот код, я не получаю правильный вывод здесь, строка должна иметь a и b, и X должен быть в середине строки, и мы должны проверить, является ли строка палиндромом или нет.