title: How to move values from a CSV file to a float array?
body: <p>I have a <code>.csv</code> file formatted like this:</p>
  
  <pre><code>24.74,2.1944,26.025,7.534,9.317,0.55169 [etc]
  </code></pre>
  
  <p>I want to move the float values into a floating point number array.</p>
  
  <p>The array would look like this:</p>
  
  <pre><code>fValues[0] = 24.74
  fValues[1] = 2.1944
  fValues[2] = 26.025
  fValues[3] = 7.534
  fValues[4] = 9.317
  [etc]
  </code></pre>
  
  <p>I have 1000 numbers to process. </p>
  
  <p>What is the code to achieve this task? </p>
  
  <p>This is the closest I have gotten with my code:</p>
  
  <pre><code>int main()
  {
    FILE *myFile;
  
    float fValues[10000];
    int n,i = 0;
  
    myFile = fopen("es2.csv", "r");
    if (myFile == NULL) {
      printf("failed to open file\n");
      return 1;
    }
  
    while (fscanf(myFile, "%f", &amp;fValues[n++]) != EOF);
  
    printf("fValues[%d]=%f\n", i, fValues[5]); //index 5 to test a number is there.
  
    fclose(myFile);
    return 0;
  }
  </code></pre>
  
  <p>Also, when I run this code I receive exit code <code>3221224725</code>. </p>
  
  <p>Would this be a memory access related issue/stack overflow)?</p>
  
  <p>My environment:</p>
  
  <ul>
  <li>Sublime Text 3,</li>
  <li>GCC compiler, </li>
  <li>Newer windows laptop </li>
  </ul>