how to determine the number of numbers in a text file in C <p>I'm reading a text file of numbers and I want to get the sum of this number, how can I determine the number of numbers in the text file."my text file is consist of one line"</p> <p>this is the code I have written, how to determine number of numbers in the text file to put it instead of the variable "number of numbers" in the secondline of code </p> <pre><code>int main() { FILE *file = fopen("numbers.txt", "r"); int integers[number of numbers]; int i=0; int j=0; int num; while(fscanf(file, "%d", &amp;num) &gt; 0) { integers[i] =num; printf("%d",integers[i]); printf("\n"); i++; } int sum=0; for(j=0;j&lt;sizeof(integers)/sizeof(int);j++) { sum=sum+integers[j]; } printf("%d",sum); printf("\n"); fclose(file); return 0; } </code></pre>