-
Core dumps
I was just wondering... I never tried working with files and arrays, perhaps I am missing a point how to make these two work together.
I have a file with a certain number of integers. I am opening the file, and place each integer into an array. That's how I wrote the code. Is it correct/allowable?
Code:
for(i = 0; i < HUNDRED; i++)
fscanf(f_p1, "%d", array1[i]);
-
If array1[i] is an array of ints, you need to pass the address of the element: &(array1[i]) or simply array1+i.
-
THANKS! I would not even think about this! You saved my life.