Purpose: Use arrays & strings.
Description:
Write a function that determines if a string contains a
single word palindrome.
Pass a string to the function and have it return true or
false indicating whether the string contains a single
word palindrome.
Okay so here is where i am at.
I have a function to check for palindrome but now I need to have one function that tests a whole phrase instead of just a word which means i need it to ignore spaces and caps.
Below is the code I have that tests for palindrome although it doesnt ignore spaces or caps which is where i guess i need help.
void pal(char *str1)
{
int i;
int x;
x = strlen(str1)-1;
for ( i = 0; i<=x; i++)
{
if(str1[i] == str1[x-i])
{
printf(" Your String is a Palindrome \n");
return 0;
}
else
{
printf(" Your String is not a Palindrome \n");
return 0;
}
}
}
In the end goal is to have one functions that tests a phare for palindrome and ignores spaces and caps.