title: What numeric type to choose for small loop counters?
body: <p>Consider that <em>int</em> take 4 bytes in memory.</p>
  
  <p>to understand what I'm looking for take this example : </p>
  
  <p><code>for(x=0;x&lt;10;x++)
      //do something</code></p>
  
  <p>in this for instruction I know that the value of <strong>x</strong> is less than <strong>11</strong>,</p>
  
  <p>I have seen lot of code and most people declare <strong>x</strong> like an <em>int</em>,</p>
  
  <p>why we shouldn't or why most people doesn't declare <strong>x</strong> like a <em>short</em> or even like a <em>char</em> !!</p>
  
  <p>I thought in the reason and I found this explanation, for example :</p>
  
  <p><code>short s=5;</code></p>
  
  <p><strong>s</strong> take 2 bytes in memory, and what I know is that the compiler consider <strong>5</strong> like an <em>int</em>
  so to put <strong>5</strong> to <strong>s</strong>, <strong>5</strong> should be converted to <em>short</em> right !!</p>
  
  <p>-> so this instruction take <strong>less memory but more work</strong></p>
  
  <p><code>int i=5;</code></p>
  
  <p>here <strong>i</strong> take 4 bytes but with no need for conversation (<strong>5</strong> is an <em>int</em>)</p>
  
  <p>-> so this instruction do <strong>less work but take more memory</strong></p>
  
  <p>is the reason something like what I thought !!</p>
  
  <p>I hope that my question was clear</p>