title: Reading and storing values from csv file in an array using C
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main() {
      int c1[100];
      char c2[150];
      char c3[100];
      float c4[100];
      float c5[100];
      float c6[100];
      float c7[100];
      char c8[100];
      char c9[100];
      float c10[100];
      char string[10][100];
      int i, j;
      char c;
  
      FILE *fp1;
      fp1 = fopen("sample.csv", "r");
      while (1) {
          c = fgetc(fp1);
          if (c == EOF)
              break;
          else
              printf("%c", c);
      }
  
      for (i = 1; i &lt;= 10; i++) {
          fscanf(fp1, "%d,%[^,],%[^,],%[^,],%[^,],%d,%d",
                 &amp;c1[i], &amp;c2[i], &amp;c3[i], &amp;c4[i], &amp;c5[i],
                 &amp;c6[i], &amp;c7[i], &amp;c8[i], &amp;c9[i], &amp;c10[i]);
      }
  
      for (j = 0; j &lt;= 10; j++) {
          printf("\n");
          printf("%d", c3); //Here i am trying to read the column3 values but getting random integer values.
          //This problem continues to every column
      }
      return 0;
  }
  </code></pre>
  
  <p>I have to read file <strong>sample.csv</strong> and store values into the array so that I can perform operation on that values.
  I am not getting the exact value from the csv file that I have read. 
  I am getting some random integer value on running the program.</p>