My program should work for any number of items up to 100. My file that I am scanning into my array only contains something like 31 integers. How can i scan only those integers into my array and them print them to the user? As I stand right now, I am printing 31 numbers, followed by 69 zeros. Here is my code for the scanning/printing:
Code:
/* Get all the data from the file */
for (i = 0; i < SIZE; i++)
{
fscanf(inp, "%d", &temp[i]);
}
/* Print all the data from the file */
for (j = 0; j < i; j++)
{
printf("%d\n", temp[j]);
}