I'm trying to reverse a string using the function strrev(). I know that strrev returns a pointer to the reversed string so I simply initialize an already allocated string with same size as the original one with the strrev function return. Obviously this isn't the correct way to do it and I get an "incompatible types" error in that line.
Here's the code:
int ispalindrome(int n)
{
char s[10], sr[10];
itoa(n, s, 10);
printf("%s", s);
sr = strrev(s);
printf("\nReverse: %s", sr);
if(strcmp(s, sr) == 0)
return 1;
else
return 0;
}