Palindrome in a function

I'm trying to write a program that will use functions that can tell whether or not something is a palindrome. The definition for the function is

[bool palindrome(const char s[]);
// Precondition: String s has a value with no blanks in it
// Postcondition: A value of true is returned if s is a palindrome
// Otherwise a value of false is returned.][/code]

And I here is what I have:

[bool palindrome(const char s[])
{
bool pal = true; // assume s is a palindrome until mismatch is found
int n = strlen(s);
for ( int i = 0; i<n; i++)
{
strcmp(const char str1), (const char str2)
if (s[i] = s[n-1])
{
i++;
}
}
// Continue until a mistake is found

}
{
return pal;
}][/code]

My problem is that this won't build, anybody know why?
If it won't compile, at least tell us what errors the compiler is giving. One thing I see you'd probably want to fix is your if statement; = is used for assignment. You want == for comparison.
Topic archived. No new replies allowed.