I'm fairly new to C and I'm having a little bit of a problem. I have to write a program that takes user input and determines if the input is a palindrome. I've got the program to reverse the input, but I'm having trouble getting the strings to compare. All input comes out as not being a palindrome. I'm suppose to use integer subscript index to be able to compare the input. Also I'm suppose to ignore all non letter characters, which I think is a c.type function.
#include <stdio.h>
#include <string.h>
#define N 50
main()
{
char array[N] = {0};
char front;
char end;
char x;
char w =0;
char i;
char forward;
char reverse;
printf("Enter Message: ");
gets(array);
front = sizeof(array);
end = sizeof(array) - 1;
for( i = 0; i <= front; i++){
forward = array[i];
}
for( x = end; x >= 0; x--){
reverse = array[x];
}
if (forward != reverse){
w = 1;
}
if(w == 1){
printf("Not a Palindrome");
}
else{
printf("Palindrome");
}
printf("\n");
return 0;
}