Member Avatar for kyeong
kyeong

I'm having trouble implementing isalpha in the correct spot.

When I put it in the if statement, it doesn't determine the palindrome correctly. It says everything I entered is a palindrome. Then I try to implement it with the int k, but then it gave me "parse error before +," whatever that means.

Here is the palindrome function, I don't think I need to show you guys the main, but if you need it, just say so.

Thanks.

int is_palindrome(const char *message)
{
	
   int k = tolower(strlen(message)-1);
   int j = 0;

   while (j<=k) {
      if(tolower(message[j]) != tolower(message[k])) 
   {
         return 0;
      }
      k--;
      j++;
   }
	   return 1;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.