# Can Someone Please Explain the Palindrome Code Coach?

I was having trouble solving the palindrome code coach and ended up having to search for help on how to solve it. I was trying to use a for loop to reverse the numbers but then couldn't figure out how to return the variable back to main to determine if it was true or false. I was only getting half of the problem correct. I found this solution on the discussions and was trying to interpret it, but I don't understand what is happening after the first function is called. Can someone please break down each section as to what is happening so I can better understand this? Thank you in advance! #include <iostream> using namespace std; int revDigit(int y) { int rem, rev = 0; while(y>0) { rem = y % 10; rev = rev * 10 + rem; y /= 10; }return rev; } bool isPalindrome(int x) { if(x == revDigit(x)) { return true; } else { return false; } } int main() { int n; cin >>n; if(isPalindrome(n)) { cout <<n<<" is a palindrome"; } else { cout << n<<" is NOT a palindrome"; } return 0; }