I wrote this function isPalindromic for my compsci class where the professor wants us to better understand how library functions work. So he asked us to write a function isPalindromic and mine isn't working as well. Because there are so many parts, I will paste the whole function, so bear with me. Sorry!
The function always returns false for some reason. The word passed is "HELLO ". My first loop checks for the size of the word without spaces or null characters so I can use it as a parameter in my second loop. This returns false, which is correct, but when I pass "HELLEH " or "HELLEH", they both return false. I've rewritten this at least 5 times, and I can't figure out why it's returning false.
char* isPalindromic(char inputCheck[]){
int actWord;
int sizeCheck = myStrLen(inputCheck);
char tempWord[actWord];
for(int check = 0; check < sizeCheck; check++){
if(inputCheck[check] = ' ' || inputCheck[check] == '\0')
actWord = check;
}
for(int replace = 0; replace < actWord; replace++){
tempWord[replace] = inputCheck[actWord - replace];
}
tempWord == inputCheck ? inputCheck = "True" : inputCheck = "False";
return inputCheck;
}