title: Atoi of a long string error
body: <p>I have this code: </p>
  
  <p>char kbits[k];
  long int bits;</p>
  
  <p>The kbits string is always filled with '1', for example:</p>
  
  <p>If k = 5,
  kbits = "11111"</p>
  
  <p>If k = 9,
  kbits = "111111111"</p>
  
  <p>To do this I use this code:</p>
  
  <p>for(i = 0; i &lt; k; i++)
       kbits[i] = '1';</p>
  
  <p>And then I run:</p>
  
  <p>bits = atoi(kbits);</p>
  
  <p>So I have the integer of kbits, for example, if kbits = "1111", bits = 1111;</p>
  
  <p>For k &lt;= 10, it runs perfectly fine.</p>
  
  <p>For k > 10 it puts a 7 in last position of kbits (for example, if k = 11, kbits = 11111111117) and bits = 2147483647 (this value is for any value of k, I think it is random?)</p>