title: Reversing an integer in c++
body: <p>Is there any better way to reverse an integer than this?</p>
  <pre><code>    int reverse(int x) {
          int out=0;
          while(x)
          {
              if(out &gt; INT_MAX/10 || out &lt; INT_MIN/10){return 0;}
              else{
                  out = out*10 + x%10;
                  x /= 10;
              }
          }
          return out;
      }
  </code></pre>