title: How does one declare a variable inside an if () statement?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1516919/declaring-and-initializing-a-variable-in-a-conditional-or-control-statement-in-c">Declaring and initializing a variable in a Conditional or Control statement in C++</a>  </p>
  </blockquote>
  
  
  
  <p>Instead of this...</p>
  
  <pre><code>int value = get_value();
  if ( value &gt; 100 )
  {
      // Do something with value.
  }
  </code></pre>
  
  <p>... is it possible to reduce the scope of <em>value</em> to only where it is needed:</p>
  
  <pre><code>if ( int value = get_value() &gt; 100 )
  {
      // Obviously this doesn't work. get_value() &gt; 100 returns true,
      // which is implicitly converted to 1 and assigned to value.
  }
  </code></pre>