为什么输入数字会输出true啊,求解。
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
int testPalindrome(char *p)
{ char *p1=p,*p2;
p2=p+strlen(p)-1;
while(p1<p2)
{
if(*(p1++)!=*(p2--))
return 0;
else
return 1;
}
}int main()
{
int T;
char p[100];
cin>>T;
for(int i=0;i<T;i++)
{
gets(p);
if(testPalindrome(p))
{
cout<<"true"<<endl;
}
else
cout<<"false"<<endl;
}
return 0;
}