/*
整数反转
*/
#include<stdio.h>
#include<limits.h>
int reverse(int x)
{
int y = 0;
while(x != 0)
{
if((y > INT_MAX/10) || (y < INT_MIN /10))
{
return 0;
}
y = y*10 + x%10;
x = x / 10;
}
return y;
}
int main()
{
int result = reverse(-2147483412);
printf("%d\n", result);
return 0;
}
07-22
1733
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-26
548
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-06
1311
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-11