title: Reading numbers from a text file into an array in C
body: <p>I'm a programming noob so please bear with me.</p>
  
  <p>I'm trying to read numbers from a text file into an array. The text file, "somenumbers.txt" simply holds 16 numbers as so "5623125698541159".</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  main()
  {
  
      FILE *myFile;
      myFile = fopen("somenumbers.txt", "r");
  
      //read file into array
      int numberArray[16];
      int i;
  
      for (i = 0; i &lt; 16; i++)
      {
          fscanf(myFile, "%d", &amp;numberArray[i]);
      }
  
      for (i = 0; i &lt; 16; i++)
      {
          printf("Number is: %d\n\n", numberArray[i]);
      }
  
  
  }
  </code></pre>
  
  <p>The program doesn't work. It compiles but outputs:</p>
  
  <p>Number is: -104204697</p>
  
  <p>Number is: 0</p>
  
  <p>Number is: 4200704</p>
  
  <p>Number is: 2686672</p>
  
  <p>Number is: 2686728</p>
  
  <p>Number is: 2686916</p>
  
  <p>Number is: 2004716757</p>
  
  <p>Number is: 1321049414</p>
  
  <p>Number is: -2</p>
  
  <p>Number is: 2004619618</p>
  
  <p>Number is: 2004966340</p>
  
  <p>Number is: 4200704</p>
  
  <p>Number is: 2686868</p>
  
  <p>Number is: 4200798</p>
  
  <p>Number is: 4200704</p>
  
  <p>Number is: 8727656</p>
  
  <p>Process returned 20 (0x14)   execution time : 0.118 s
  Press any key to continue.</p>