Hello All, I am new in C++ programming and trying to check the number is palindrome or not. Check the below code, The code have number 12321 is a palindrome number, but 1451 is not a palindrome number and what would happen if the number is greater than 1018?
Code:
bool checkPalindrome(string original) {
int n = original.size();
for (int i = 0; i < n / 2; i++) {
if (original[i] != original[n - 1 - i]) {
return false;
}
}
return true;
}
Taking this code reference from <<spam removed>> Can anyone tell me, Is it right?