In the Leetcode Reverse Integer problem solution in C programming Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 – 1], then return 0.

Assume the environment does not allow you to store 64-bit integers (signed or unsigned).

## Leetcode Reverse Integer problem solution in C programming

```
int reverse(int x){
long long int x1 = (long long int)x;
long long int rev = 0;
long long int pop = 0;
long long int temp = 0;
if(x1<0)
{
x1=x1*(-1);
}
while(x1>0)
{
pop = x1%10;
x1 = x1/10;
temp = rev*10 + pop;
rev = temp;
}
if(x1<0)
{
return rev*-1;
}
else if(rev>=2147483647 || rev<=-2147483648)
{
return 0;
}
else if(x<0)
{
return rev*-1;
}
else
{
return (rev);
}
}
```

**Also read,**

- Leetcode Reverse Integer problem solution in C++
- Leetcode Reverse Integer problem solution in Java
- Leetcode Reverse Integer problem solution in Python
- Leetcode Reverse Integer problem solution in C#