字符串-----判断字符串是否为回文

题目:

思路:

代码:

int IsRevStr(char *str)
{
	int i,len;
	int found=1;  //表示是回文
	
	if(str == NULL)
	{
		return -1;
	}
	
	len = strlen(str);
	
	for(int i=1;i<len/2;i++)
	{
		if(*(str+i)!=*(str+len-i-1)
		{
			found =0;
			break;
		}
	}
	return found;
}

猜你喜欢

转载自blog.csdn.net/qq_39503189/article/details/82704688