int isPalindrome(int number) { int a, t; for(t = number, a = 0; t; t /= 10) { a *= 10; a += t % 10; } return number == a; }
int isPalindrome(int number) { int a, t, n; for(t = number, a = n = 0; t; n++, t /= 10) { a *= 10; a += t % 10; } return !(n & 1) && number == a && n; //最后的n是为了判断number == 0的情况,也可以换成a或number }