I've been working on this for a while but can't seem to get it to work. In the checkPalin() function, I write the entire code from prompting the user to input a desired amount of strings. Then I go one string at a time to check if it is a palindrome. What I tried doing was taking in the string and taking the reverse to compare them. I repeat these steps until the number of strings the user wanted is input. I then return the actual palindromes and call the function in main but it only prints the first palindrome. I can only use the string library.
Even if this is just a little oversight (I make worse errors 1000 times a day), it’s due to a bad habit: declaring all variables at the beginning of a function. You shouldn’t declare any variable until you really need it.
In this case, both “str1“ and “reverse” could be declared inside your loop because their lifespans don’t need to stretch beyond it.