This is what I was trying to do I finished
Code:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
char upper(char array[]);
char palindrome(char array[], int length);//function prototypes
int main(void)
{
char array[200];
int length, result=5;//char declarations
printf("Enter in a word to compare");//scans user input word to char array
scanf("%s", &array);
length = strlen(array); //gets string length of array
upper(array);
result=palindrome(array,length);//function call for uppercase, and stores returns for palindrome in result
if(result==1)
printf("%s, is a palindrome", array);
else
printf("%s, is not a palindrome", array);// if result = 1 it's a palindrom, else it is not
getchar();
}
char upper(char array[]) //upper case function definition
{
int i=0;
while (array[i] != '\0'){ //while array[i] does not = end of string make array[i] uppercase, then increase pointer
array[i]=toupper(array[i]);
++i;
}
}
char palindrome(char array[], int length)//palindrom function definition passing array and length
{
if(length<2) //if length of string is less than 2 return 1
return 1;
if (array[0] != array[length-1]) // if array at pointer 0 is not equal to array at length -1 return 0
return 0;
else
return palindrome (array+1, length-2); //if they are equal call the function again
}