Hi everyone I want check input(char or int) polindrome or not but I can't do this. Can you help me ? I have error message
"invalid conversation char to char*"
I think this is a simple problem but I couldn't solve it already. Thank you for your help.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int main()
{
int r,sum=0,temp;
char a;
char *b = &a;
printf("Enter a string or number\n");
scanf("%c", &a);
if ( isalpha( a ) )
{
b = a;
strrev(b);
if (strcmp(a, b) == 0)
printf("The string is a palindrome.\n");
else
printf("The string isn't a palindrome.\n");
}
else if ( isdigit( a ) )
{
temp=a;
while(a>0)
{
r=a%10;
sum=(sum*10)+r;
a=a/10;
}
if(temp==sum)
printf("palindrome number ");
else
printf("not palindrome");
}
return 0;
}