title: Is there any overhead to declaring a variable within a loop? (C++)
body: <p>I am just wondering if there would be any loss of speed or efficiency if you did something like this:</p>
  
  <pre><code>int i = 0;
  while(i &lt; 100)
  {
      int var = 4;
      i++;
  }
  </code></pre>
  
  <p>which declares <code>int var</code> one hundred times.  It seems to me like there would be, but I'm not sure. would it be more practical/faster to do this instead:</p>
  
  <pre><code>int i = 0;
  int var;
  while(i &lt; 100)
  {
      var = 4;
      i++;
  }
  </code></pre>
  
  <p>or are they the same, speedwise and efficiency-wise?</p>